pub fn drive_socket_blocking(
pool: &WorkerPool<2>,
stream: TcpStream,
label: &str,
config: &PumpConfig,
) -> Result<(GuardedReader, GuardedWriter)>Expand description
Drive one already-connected socket with two blocking pumps, returning the two owning adapters.
This is the whole seam for a caller that has no teardown thread: hand it a
connected TcpStream, receive an AsyncRead and an AsyncWrite that the
protocol code cannot tell from a split socket, with both pump threads owned
by the values returned.
The socket’s blocking mode is taken over here (own_blocking_mode,
crate-private), and fatally: it is what makes both pumps’ bounds hold by
construction rather than wherever a flag or option is honoured, so a target
that refused it would be a target this seam cannot bound, and that is worth
a failed dial rather than a silent park. SO_RCVTIMEO is still set, also
fatally, but as the value the reader’s wait uses and as the mechanism on
the not(unix) arm; on unix the wait is a POLLIN poll. There is no
send-side counterpart: write_frame_deadline owns its own bound and needs
no socket option, so there is nothing here for a target that implements
fewer of them to switch off.
§The pool, and the two bands it carries
The two pumps come from one leased worker set of pool, taken atomically so
a circuit at capacity can never hold one pump and block for the other. Their
bands are the pool roster’s, not this function’s: at least one caller’s
upstream C derives two — libca gives a circuit’s receive thread
highestPriorityLevelBelow(initializing thread) and its send thread
lowestPriorityLevelAbove(...) (tcpiiu.cpp:677-682), so the sender sits
above the receiver and can always drain a queue the receiver’s work is
filling — and a caller whose upstream uses one band for both (pvxs, one
reactor thread) declares the same band twice in its roster. The Err is now
admission’s: io::ErrorKind::WouldBlock when the circuit pool is full,
otherwise a socket-option or thread-creation failure.