Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Use inbound peerslot slots when a substream is received, rather than …
Browse files Browse the repository at this point in the history
…a connection (#7464)

* Use inbound peerslot slots when a substream is received, rather than a connection

* Refactor PeerState

* Some bugfixes

* Fix warnings so that CI runs, gmlrlblbl

* Bugfixes

* Update docs

* Apply suggestions from code review

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>

* Clean up Banned state

* Refactor connections state

* Fix possibility of Enabled with no Opening or Open connection

* Line width

* Add some debug_asserts! and fix TODO

* Refactor legacy handler

* Rewrite group.rs entirely [part 1]

* Rewrite group.rs entirely [part 2]

* Remove faulty assertion

Because of the asynchronous nature of the behaviour <-> handler communications, it is possible to receive notifications while in the Closing state

* Don't poll the legacy substream is not Open

* Tolerate when not all substreams are accepted

* Remove TODOs

* Dummy commit to make CI log interesting things

* Try race condition fix

* Revert "Try race condition fix"

This reverts commit 0675c65.

* Correctly rebuild pending_opening

* Minor tweaks

* Printlns for CI debugging

* Revert "Printlns for CI debugging"

This reverts commit e7852a2.

* Revert "Dummy commit to make CI log interesting things"

This reverts commit 259ddd7.

* mv group.rs ../handler.rs

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Banned => Backoff

* Mention the actual PeerStates

* OpenDesired -> OpenDesiredByRemote

* OpeningThenClosing

* Add doc links to PeerState

* Simplify increment logic

* One more debug_assert

* debug_assert!

* OpenDesiredByRemote

* Update client/network/src/protocol/generic_proto/behaviour.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
  • Loading branch information
3 people authored Nov 16, 2020
1 parent 74e01c8 commit 99602cd
Show file tree
Hide file tree
Showing 10 changed files with 2,197 additions and 2,600 deletions.
4 changes: 2 additions & 2 deletions client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub mod message;
pub mod event;
pub mod sync;

pub use generic_proto::{NotificationsSink, Ready, NotifsHandlerError, LegacyConnectionKillError};
pub use generic_proto::{NotificationsSink, Ready, NotifsHandlerError};

const REQUEST_TIMEOUT_SEC: u64 = 40;
/// Interval at which we perform time based maintenance
Expand Down Expand Up @@ -1668,7 +1668,7 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviour for Protocol<B, H> {
notifications_sink,
}
},
GenericProtoOut::CustomProtocolClosed { peer_id, .. } => {
GenericProtoOut::CustomProtocolClosed { peer_id } => {
self.on_peer_disconnected(peer_id)
},
GenericProtoOut::LegacyMessage { peer_id, message } =>
Expand Down
2 changes: 1 addition & 1 deletion client/network/src/protocol/generic_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! network, then performs the Substrate protocol handling on top.

pub use self::behaviour::{GenericProto, GenericProtoOut};
pub use self::handler::{NotifsHandlerError, NotificationsSink, Ready, LegacyConnectionKillError};
pub use self::handler::{NotifsHandlerError, NotificationsSink, Ready};

mod behaviour;
mod handler;
Expand Down
1,672 changes: 1,149 additions & 523 deletions client/network/src/protocol/generic_proto/behaviour.rs

Large diffs are not rendered by default.

1,055 changes: 1,041 additions & 14 deletions client/network/src/protocol/generic_proto/handler.rs

Large diffs are not rendered by default.

Loading

0 comments on commit 99602cd

Please sign in to comment.