You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Broker: make aborting a pending TCP connect on shutdown a guest-neutral platform operation #1771
On the ulitebox branch, shutting down a TCP socket whose connect is pending follows Linux's tcp_disconnect, but the broker implements it rather than the Linux shim. Each socket provider aborts the connect and fails it with SocketError::ConnectionReset: the smoltcp provider (litebox_broker_smoltcp/src/tcp.rs, "As Linux's tcp_disconnect"), and, with #1752, the userland provider (abort_pending_connect in litebox_broker_userland/src/socket/tcp.rs). The userland provider has to do it itself because Winsock doesn't abort a pending connect on shutdown. Broker core's shutdown_stream (litebox_broker_core/src/socket.rs) infers the abort: when a shutdown completes and status() then reports Failed, core resets the socket's connection instead of recording the shutdown. #1752 states this requirement on PlatformSocket::shutdown, but it is still guest semantics in a guest-neutral layer: the broker, not the shim, decides that the connect aborts and which error the guest sees.
Consequences
A guest with different shutdown semantics can't get them without changing every provider.
Linux lets a socket connect again after tcp_disconnect aborts its connect. The broker's socket stays failed, so the shim can't offer that.
Proposed direction
Make cancelling a pending connect an explicit, guest-neutral operation, in one of two ways:
a stated PlatformSocket::shutdown requirement whose outcome carries no guest error, for example a distinct aborted status;
a separate cancel-connect operation.
Have the Linux shim decide when a shutdown cancels a pending connect. It should report ECONNRESET once, as tcp_disconnect does, and could let the socket connect again.
Change core, smoltcp and the userland provider together. tcp_broker_states.c should pass unchanged on both the Linux and Windows brokers.
Activity