forked from libp2p/rust-libp2p
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite dial-request to always index by nonce
The nonce of a probe is essentially like a primary key that is decided by the client. Thus, any event emitted by the handler should be indexed by the provided nonce. We can achieve this by using a `FuturesMap` instead of a `FuturesSet`. This gives us access to the nonce even in the case that the actual protocol times out. With the nonce in place, we had to re-model the event returned to the behaviour. Most importantly. we need to separate the different kinds of errors: - Complete execution of the protocol but address is not reachable - Protocol was aborted mid-way - Server does not support the protocol We can't really do anything if the protocols is aborted so we just represent this case with an `io::Error` that gets logged further up. As a result, this means we can remove the `Option` from the event emitted to the user and _always_ give them a `Multiaddr`.
- Loading branch information
1 parent
8ce2a01
commit 42ac03c
Showing
4 changed files
with
238 additions
and
318 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
pub(crate) mod dial_back; | ||
pub(crate) mod dial_request; | ||
|
||
pub(crate) use dial_request::TestEnd; |
Oops, something went wrong.