-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kad: Fix substream opening and dialing race (#222)
This PR makes the substream opening and dialing of query commands more robust. In the past, the logic of a query action would: - T0; try to open a substream - T1; try to dial the peer There is a race between the moment when a substream is opened and when the peer is dialed (T0 and T1), where the peer could connect to us. The race manifested after extensively running `FindNode` commands via [subp2p-explorer bench-cli](https://github.com/lexnv/subp2p-explorer/tree/main/bench-cli) To mitigate this race, retry to open the substream on recoverable errors from dialing (ie Error::PeerAlreadyConnected). cc @paritytech/networking --------- Signed-off-by: Alexandru Vasile <[email protected]>
- Loading branch information
Showing
2 changed files
with
77 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters