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
impl RecvMemory
Sourcepub fn after_handshake(drained: bool) -> Self
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
impl Clone for RecvMemory
impl Copy for RecvMemory
Source§impl Debug for RecvMemory
impl Debug for RecvMemory
Source§impl Default for RecvMemory
impl Default for RecvMemory
impl Eq for RecvMemory
Source§impl PartialEq for RecvMemory
impl PartialEq for RecvMemory
impl StructuralPartialEq for RecvMemory
Auto Trait Implementations§
impl Freeze for RecvMemory
impl RefUnwindSafe for RecvMemory
impl Send for RecvMemory
impl Sync for RecvMemory
impl Unpin for RecvMemory
impl UnsafeUnpin for RecvMemory
impl UnwindSafe for RecvMemory
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.