-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Networking & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The base class implementation of waitForPeerDisconnectUntil checks isConnected periodically, sleeping in between.
HandoffSession could instead poll() its file descriptor for hangup/read events, then attempt a peek read if a read event results. Or we could do whatever the ASIO implementation does.
This leaves the question of "what happens if the client sends some data that we don't consume, then shuts down the write end of its socket?" On Linux we'd get POLLRDHUP, so it's fine, but the general question deserves revisiting.
Finally, there are a lot of such similarities between the ASIO session implementation and HandoffSession – they're both thin wrappers around a socket. We might consider creating a new abstraction that they both can derive from or otherwise share, so functions like isConnected, waitForPeerDisconnectedUntil, and markKillOnClientDisconnect can have a common implementation between ASIO and handoff sessions. That work could be considered in a separate ticket or in this one.
See:
- related to
-
SERVER-132915 Provide a robust default implementation of waitForPeerDisconnectUntil
-
- Closed
-