-
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.
…#1398) We do this by properly utilising `libp2p::request_response` and representing a `BlockRequest` and a `BlockResponse` as an actual request and response pair. Previously, both were requests at the libp2p level and would be responded to by an empty ACK. `libp2p::request_response` now sends us a request timeout failure if a response is not received for a request within 10 seconds. This triggers the existing retry logic in `BlockStore` and we successfully make the request again (hopefully from a different peer). To achieve this I refactored the interaction between the libp2p layer and `Node`. Instead of all messages being passed to `handle_network_message`, I have split this into 4 different methods: * `handle_broadcast` * `handle_request` * `handle_request_failure` * `handle_response` Importantly, `handle_request` takes `ResponseChannel` as an argument. When the handler is ready to respond to the request it sends that `ResponseChannel` (and the actual response) to a new `request_responses` channel. The libp2p layer picks up these responses and passes them on to the network. This is a slightly leaky abstraction, since the `ResponseChannel` is libp2p-specific but the node knows about it. This isn't awful, but it does mean we need some compile-time feature flag shenanigans to allow the integration test suite (which doesn't use libp2p) to construct fake versions of the `ResponseChannel`. I hope this is reasonably well documented in the code and not too ugly.
- Loading branch information
1 parent
73e9431
commit 6c8c343
Showing
11 changed files
with
393 additions
and
205 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.