-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnect flow does not check for dead sockets #142
Comments
You cannot check if the connection is valid or invalid. Once the socket is determined to back a broken connection by an act of sending data and reading back a response, the socket will be closed, reference set to None and and a new socket will be created on the next reconnect. |
You can try to handle connection errors with some sort of a retry. |
@george-unbotify Retries are not possible without server-based ACK which is a separate issue #120 altogether. Without ACK, there is no possibility, even in theory to know whether the socket is dead unless the router actively sends ICMP to indicate the connection has been broken or kernel detects it by other means. This is a fundamental limitation of the TCP protocol and has been there since 1974. If the socket errors out, the reconnect is called automatically after the socket reference it's cleared. Reconnect on every send if necessary: Close and reset socket if any error occurred and was detected: |
Furthermore, even in theory, a user cannot add a retry mechanism of any kind with any degree of reliability without server-side ack. |
It seems that reconnect() only checks if socket exists and does not check for disconnected sockets.
To reproduce the issue:
Step 4 fails due to a connection reset by peer error.
The text was updated successfully, but these errors were encountered: