-
Notifications
You must be signed in to change notification settings - Fork 602
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
Detect silent network drops. #320
Conversation
c55f8b9
to
f2b39ae
Compare
This change introduces additional network activity with the btcd process to ensure that the network connection is not silently dropped. Previously, if the connection was lost (e.g. wallet runs on a laptop and connects to remote btcd, and the laptop is suspended/resumed) the lost connection would not be detectable since all normal RPC activity (excluding requests from btcwallet to btcd made by the user) is in the direction of btcd to wallet in the form of websocket notifications. Rather than simply pinging the server and waiting for the response, a unique session ID has been added for each websocket client connection. These session IDs are randomly generated by the btcd RPC server when a new websocket connection is established, and are queried using the session RPC. If the session ID changes, it is assumed that the connection silently reconnected, and the client is shutdown for this case as well.
This appears to be resetting back to height 0 after a disconnect:
|
It appears working properly now with the latest commit:
|
Session ID doesn't have to be checked since we control the btcrpcclient reconnect logic by disabling it.
OK (after squash and rebase to master) |
squashed+merged as 33d053c |
This change introduces additional network activity with the btcd
process to ensure that the network connection is not silently dropped.
Previously, if the connection was lost (e.g. wallet runs on a laptop
and connects to remote btcd, and the laptop is suspended/resumed) the
lost connection would not be detectable since all normal RPC activity
(excluding requests from btcwallet to btcd made by the user) is in the
direction of btcd to wallet in the form of websocket notifications.
Rather than simply pinging the server and waiting for the response, a
unique session ID has been added for each websocket client connection.
These session IDs are randomly generated by the btcd RPC server when a
new websocket connection is established, and are queried using the
session RPC. If the session ID changes, it is assumed that the
connection silently reconnected, and the client is shutdown for this
case as well.
Requires btcsuite/btcd#500 and btcsuite/btcrpcclient#62