Skip to main content

RecvMemory

Struct RecvMemory 

Source
pub struct RecvMemory { /* private fields */ }
Expand description

What rustls_socket_read may assume about the receive queue between two calls.

The H2 read path makes one call per frame header and one per payload (lib/src/protocol/mux/h2.rs, readable_inner), so the frames of one record are served by several calls: the first one’s recv is short, the rest come from rustls’s plaintext buffer. Without a memory, the call that finds that buffer empty issued one more recv, which could only answer EAGAIN — once per request on a multiplexed connection (#1609).

drained carries the proof across calls, and is safe for as long as no readiness event has been delivered since it was set. mio registers every socket edge-triggered (mio/src/sys/unix/selector/epoll.rs, EPOLLET), and “an event will be generated upon each receipt of a chunk of data” (man 7 epoll), so a byte that arrives after the proof either raises an event still pending in epoll — the next epoll_wait delivers it and re-arms READABLE — or one already delivered, which cleared drained. A delivery that lands while the mux still holds READABLE changes nothing the mux can see, which is why the memory is cleared at delivery rather than inferred from READABLE.

hup_seen turns the memory off for good once HUP or ERROR is delivered. A FIN that arrived with the data raised its edge already, and no later event will announce the EOF behind a short read; the mux keeps READABLE for it (update_readiness_after_read), and the next call must read it.

The TCP urgent data reserve of plain_socket_read applies unchanged: a recv stopped short by an urgent mark proves nothing, and the stream stalls until the peer’s next send, as it does within a call since #1606.

Implementations§

Source§

impl RecvMemory

Source

pub fn after_handshake(drained: bool) -> Self

The memory a session starts with once its handshake is over. drained is what the handshake proved: a recv that answered short or EAGAIN dropped READABLE from its event, and only a delivered event with READABLE put it back (handshake_read, lib/src/protocol/rustls.rs). A handshake closes on HUP or ERROR, so none was seen.

Trait Implementations§

Source§

impl Clone for RecvMemory

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RecvMemory

Source§

impl Debug for RecvMemory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RecvMemory

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for RecvMemory

Source§

impl PartialEq for RecvMemory

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RecvMemory

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for T
where T: Default + Clone,

Source§

fn reset(&mut self)

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.