Skip to content
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

refactor: mark {In, Out}boundOpenInfo as deprecated #5242

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
8 changes: 4 additions & 4 deletions protocols/autonat/src/v2/client/handler/dial_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl ConnectionHandler for Handler {
type InboundOpenInfo = ();
type OutboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(ReadyUpgrade::new(DIAL_BACK_PROTOCOL), ())
}

fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
loop {
match self.inbound.poll_next_unpin(cx) {
Expand Down Expand Up @@ -71,8 +71,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
10 changes: 5 additions & 5 deletions protocols/autonat/src/v2/client/handler/dial_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub struct Handler {
queued_events: VecDeque<
ConnectionHandlerEvent<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
<Self as ConnectionHandler>::ToBehaviour,
>,
>,
Expand Down Expand Up @@ -121,15 +121,15 @@ impl ConnectionHandler for Handler {
type InboundOpenInfo = ();
type OutboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(DeniedUpgrade, ())
}

fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
if let Some(event) = self.queued_events.pop_front() {
return Poll::Ready(event);
Expand Down Expand Up @@ -164,8 +164,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
8 changes: 4 additions & 4 deletions protocols/autonat/src/v2/server/handler/dial_back.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ impl ConnectionHandler for Handler {
type InboundOpenInfo = ();
type OutboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(DeniedUpgrade, ())
}

fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
if let Poll::Ready(result) = self.outbound.poll_unpin(cx) {
return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(
Expand All @@ -79,8 +79,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
8 changes: 4 additions & 4 deletions protocols/autonat/src/v2/server/handler/dial_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ where
type InboundOpenInfo = ();
type OutboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(ReadyUpgrade::new(DIAL_REQUEST_PROTOCOL), ())
}

fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
loop {
match self.inbound.poll_unpin(cx) {
Expand Down Expand Up @@ -120,8 +120,8 @@ where
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
18 changes: 9 additions & 9 deletions protocols/dcutr/src/handler/relayed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct Handler {
queued_events: VecDeque<
ConnectionHandlerEvent<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
<Self as ConnectionHandler>::ToBehaviour,
>,
>,
Expand Down Expand Up @@ -100,7 +100,7 @@ impl Handler {
protocol: output, ..
}: FullyNegotiatedInbound<
<Self as ConnectionHandler>::InboundProtocol,
<Self as ConnectionHandler>::InboundOpenInfo,
(),
>,
) {
match output {
Expand Down Expand Up @@ -132,7 +132,7 @@ impl Handler {
protocol: stream, ..
}: FullyNegotiatedOutbound<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
>,
) {
assert!(
Expand All @@ -156,7 +156,7 @@ impl Handler {
fn on_listen_upgrade_error(
&mut self,
ListenUpgradeError { error, .. }: ListenUpgradeError<
<Self as ConnectionHandler>::InboundOpenInfo,
(),
<Self as ConnectionHandler>::InboundProtocol,
>,
) {
Expand All @@ -168,7 +168,7 @@ impl Handler {
fn on_dial_upgrade_error(
&mut self,
DialUpgradeError { error, .. }: DialUpgradeError<
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
<Self as ConnectionHandler>::OutboundProtocol,
>,
) {
Expand Down Expand Up @@ -196,7 +196,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type InboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
match self.endpoint {
ConnectedPoint::Dialer { .. } => {
SubstreamProtocol::new(Either::Left(ReadyUpgrade::new(PROTOCOL_NAME)), ())
Expand Down Expand Up @@ -237,7 +237,7 @@ impl ConnectionHandler for Handler {
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
// Return queued events.
if let Some(event) = self.queued_events.pop_front() {
Expand Down Expand Up @@ -298,8 +298,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
12 changes: 6 additions & 6 deletions protocols/gossipsub/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl EnabledHandler {
&mut self,
FullyNegotiatedOutbound { protocol, .. }: FullyNegotiatedOutbound<
<Handler as ConnectionHandler>::OutboundProtocol,
<Handler as ConnectionHandler>::OutboundOpenInfo,
(),
>,
) {
let (substream, peer_kind) = protocol;
Expand All @@ -221,7 +221,7 @@ impl EnabledHandler {
) -> Poll<
ConnectionHandlerEvent<
<Handler as ConnectionHandler>::OutboundProtocol,
<Handler as ConnectionHandler>::OutboundOpenInfo,
(),
<Handler as ConnectionHandler>::ToBehaviour,
>,
> {
Expand Down Expand Up @@ -427,7 +427,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type OutboundProtocol = ProtocolConfig;

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
match self {
Handler::Enabled(handler) => {
SubstreamProtocol::new(either::Either::Left(handler.listen_protocol.clone()), ())
Expand Down Expand Up @@ -463,7 +463,7 @@ impl ConnectionHandler for Handler {
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
match self {
Handler::Enabled(handler) => handler.poll(cx),
Expand All @@ -486,8 +486,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match self {
Expand Down
12 changes: 6 additions & 6 deletions protocols/identify/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Handler {
protocol: output, ..
}: FullyNegotiatedInbound<
<Self as ConnectionHandler>::InboundProtocol,
<Self as ConnectionHandler>::InboundOpenInfo,
(),
>,
) {
match output {
Expand Down Expand Up @@ -200,7 +200,7 @@ impl Handler {
protocol: output, ..
}: FullyNegotiatedOutbound<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
>,
) {
match output {
Expand Down Expand Up @@ -296,7 +296,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type InboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(
SelectUpgrade::new(
ReadyUpgrade::new(PROTOCOL_NAME),
Expand Down Expand Up @@ -327,7 +327,7 @@ impl ConnectionHandler for Handler {
fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Event>> {
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Event>> {
if let Some(event) = self.events.pop() {
return Poll::Ready(event);
}
Expand Down Expand Up @@ -393,8 +393,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
12 changes: 6 additions & 6 deletions protocols/kad/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl Handler {
info: (),
}: FullyNegotiatedOutbound<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
>,
) {
if let Some(sender) = self.pending_streams.pop_front() {
Expand All @@ -500,7 +500,7 @@ impl Handler {
&mut self,
FullyNegotiatedInbound { protocol, .. }: FullyNegotiatedInbound<
<Self as ConnectionHandler>::InboundProtocol,
<Self as ConnectionHandler>::InboundOpenInfo,
(),
>,
) {
// If `self.allow_listening` is false, then we produced a `DeniedUpgrade` and `protocol`
Expand Down Expand Up @@ -608,7 +608,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type InboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
match self.mode {
Mode::Server => SubstreamProtocol::new(Either::Left(self.protocol_config.clone()), ()),
Mode::Client => SubstreamProtocol::new(Either::Right(upgrade::DeniedUpgrade), ()),
Expand Down Expand Up @@ -720,7 +720,7 @@ impl ConnectionHandler for Handler {
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
loop {
match &mut self.protocol_status {
Expand Down Expand Up @@ -791,8 +791,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
>,
) {
match event {
Expand Down
10 changes: 5 additions & 5 deletions protocols/perf/src/client/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct Handler {
queued_events: VecDeque<
ConnectionHandlerEvent<
<Self as ConnectionHandler>::OutboundProtocol,
<Self as ConnectionHandler>::OutboundOpenInfo,
(),
<Self as ConnectionHandler>::ToBehaviour,
>,
>,
Expand Down Expand Up @@ -92,7 +92,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type InboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
SubstreamProtocol::new(DeniedUpgrade, ())
}

Expand All @@ -109,8 +109,8 @@ impl ConnectionHandler for Handler {
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
(),
(),
drHuangMHT marked this conversation as resolved.
Show resolved Hide resolved
>,
) {
match event {
Expand Down Expand Up @@ -162,7 +162,7 @@ impl ConnectionHandler for Handler {
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>,
> {
if let Some(event) = self.queued_events.pop_front() {
return Poll::Ready(event);
Expand Down
Loading
Loading