-
Notifications
You must be signed in to change notification settings - Fork 43
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
seed nodes keep disconnecting #839
Comments
It looks like your node is sending |
@sangaman you are right. My node is sending getNodes request which is not being responded. The getNodes packet is ignored due to a check in lib/p2p/Peer.ts:619 - isPacketSolicited(packet) If this returns false the packet will be ignored and will lead to connection failure. Now, isPacketSolicited(packet) returns false if the connection is not market So, if A connects to B and B receives a The handshake code between A and B is not symmetric. While B is doing the last 2 operations A is already sending The new Encryption code increases the chance that the |
Awesome, thanks for this analysis that makes a lot of sense. I should be able to come up with a fix tonight. |
This commit addresses an edge case bug whereby one peer finishes the handshake before the other and begins sending regular packets. It is possible for the other peer to attempt to process these regular packets while it is executing asynchronous code to complete the handshake, which results in the regular packets being discarded as "unsolicited." This makes two changes: 1. Moves the logic to asynchronously send a `GetNodesPacket` until after we mark the peer as `opened`. 2. Add an `initializing` flag that is set to true once we receive a `SessionAckPacket`. This is an indicator that any subsequent packets we receive should not be acted upon until the handshake is complete. If we receive packets while `opened` is false but `initializing` is true, we wait to see which of the `open` or `close` events fire first to either accept or discard a packet, respectively. Fixes #839.
This commit addresses an edge case bug whereby one peer finishes the handshake before the other and begins sending regular packets. It is possible for the other peer to attempt to process these regular packets while it is executing asynchronous code to complete the handshake, which results in the regular packets being discarded as "unsolicited." This makes two changes: 1. Moves the logic to asynchronously send a `GetNodesPacket` until after we mark the peer as `opened`. 2. Add an `initializing` flag that is set to true once we receive a `SessionAckPacket`. This is an indicator that any subsequent packets we receive should not be acted upon until the handshake is complete. If we receive packets while `opened` is false but `initializing` is true, we wait to see which of the `open` or `close` events fire first to either accept or discard a packet, respectively. Fixes #839.
This commit addresses an edge case bug whereby one peer finishes the handshake before the other and begins sending regular packets. It is possible for the other peer to attempt to process these regular packets while it is executing asynchronous code to complete the handshake, which results in the regular packets being discarded as "unsolicited." The key change is marking the peer as `opened` after receiving and authenticating the `SessionInitPacket`, as well as validating the peer (not banned, not ourselves, not an incompatible version, etc...), but before we send the `SessionAckPacket`. This ensures that we are ready to accept packets before the peer is ready to send packets. This involves restructuring the open flow, splitting it into two methods (`beginOpen` and `completeOpen`). The first establishes the socket connection and begins the handshake. The second marks the peer as `opened` and compelts the handshake. In between we validate the peer, and afterwards we perform the routine for newly opened peers including sharing and asking for open orders. Fixes #839.
This commit addresses an edge case bug whereby one peer finishes the handshake before the other and begins sending regular packets. It is possible for the other peer to attempt to process these regular packets while it is executing asynchronous code to complete the handshake, which results in the regular packets being discarded as "unsolicited." The key change is marking the peer as `opened` after receiving and authenticating the `SessionInitPacket`, as well as validating the peer (not banned, not ourselves, not an incompatible version, etc...), but before we send the `SessionAckPacket`. This ensures that we are ready to accept packets before the peer is ready to send packets. This involves restructuring the open flow, splitting it into two methods (`beginOpen` and `completeOpen`). The first establishes the socket connection and begins the handshake. The second marks the peer as `opened` and compelts the handshake. In between we validate the peer, and afterwards we perform the routine for newly opened peers including sharing and asking for open orders. Fixes #839.
This commit addresses an edge case bug whereby one peer finishes the handshake before the other and begins sending regular packets. It is possible for the other peer to attempt to process these regular packets while it is executing asynchronous code to complete the handshake, which results in the regular packets being discarded as "unsolicited." The key change is marking the peer as `opened` after receiving and authenticating the `SessionInitPacket`, as well as validating the peer (not banned, not ourselves, not an incompatible version, etc...), but before we send the `SessionAckPacket`. This ensures that we are ready to accept packets before the peer is ready to send packets. This involves restructuring the open flow, splitting it into two methods (`beginOpen` and `completeOpen`). The first establishes the socket connection and begins the handshake. The second marks the peer as `opened` and compelts the handshake. In between we validate the peer, and afterwards we perform the routine for newly opened peers including sharing and asking for open orders. Fixes #839.
the connection to the seed nodes is not stable.
log attached
xud.log
The text was updated successfully, but these errors were encountered: