Skip to content

Commit 4b4f197

Browse files
authored
refactor: mark {In, Out}boundOpenInfo as deprecated
Mark `{In, Out}boundOpenInfo` as deprecated. May close #3268. Pull-Request: #5242.
1 parent 28387f2 commit 4b4f197

File tree

29 files changed

+105
-278
lines changed

29 files changed

+105
-278
lines changed

protocols/autonat/src/v2/client/handler/dial_back.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ impl ConnectionHandler for Handler {
3535
type InboundOpenInfo = ();
3636
type OutboundOpenInfo = ();
3737

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

4242
fn poll(
4343
&mut self,
4444
cx: &mut Context<'_>,
45-
) -> Poll<
46-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
47-
> {
45+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
4846
loop {
4947
match self.inbound.poll_next_unpin(cx) {
5048
Poll::Pending => return Poll::Pending,
@@ -68,12 +66,7 @@ impl ConnectionHandler for Handler {
6866

6967
fn on_connection_event(
7068
&mut self,
71-
event: ConnectionEvent<
72-
Self::InboundProtocol,
73-
Self::OutboundProtocol,
74-
Self::InboundOpenInfo,
75-
Self::OutboundOpenInfo,
76-
>,
69+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
7770
) {
7871
match event {
7972
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {

protocols/autonat/src/v2/client/handler/dial_request.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub struct Handler {
7272
queued_events: VecDeque<
7373
ConnectionHandlerEvent<
7474
<Self as ConnectionHandler>::OutboundProtocol,
75-
<Self as ConnectionHandler>::OutboundOpenInfo,
75+
(),
7676
<Self as ConnectionHandler>::ToBehaviour,
7777
>,
7878
>,
@@ -121,16 +121,14 @@ impl ConnectionHandler for Handler {
121121
type InboundOpenInfo = ();
122122
type OutboundOpenInfo = ();
123123

124-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
124+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
125125
SubstreamProtocol::new(DeniedUpgrade, ())
126126
}
127127

128128
fn poll(
129129
&mut self,
130130
cx: &mut Context<'_>,
131-
) -> Poll<
132-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
133-
> {
131+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
134132
if let Some(event) = self.queued_events.pop_front() {
135133
return Poll::Ready(event);
136134
}
@@ -161,12 +159,7 @@ impl ConnectionHandler for Handler {
161159

162160
fn on_connection_event(
163161
&mut self,
164-
event: ConnectionEvent<
165-
Self::InboundProtocol,
166-
Self::OutboundProtocol,
167-
Self::InboundOpenInfo,
168-
Self::OutboundOpenInfo,
169-
>,
162+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
170163
) {
171164
match event {
172165
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {

protocols/autonat/src/v2/server/handler/dial_back.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@ impl ConnectionHandler for Handler {
4646
type InboundOpenInfo = ();
4747
type OutboundOpenInfo = ();
4848

49-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
49+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
5050
SubstreamProtocol::new(DeniedUpgrade, ())
5151
}
5252

5353
fn poll(
5454
&mut self,
5555
cx: &mut Context<'_>,
56-
) -> Poll<
57-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
58-
> {
56+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
5957
if let Poll::Ready(result) = self.outbound.poll_unpin(cx) {
6058
return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(
6159
result
@@ -76,12 +74,7 @@ impl ConnectionHandler for Handler {
7674

7775
fn on_connection_event(
7876
&mut self,
79-
event: ConnectionEvent<
80-
Self::InboundProtocol,
81-
Self::OutboundProtocol,
82-
Self::InboundOpenInfo,
83-
Self::OutboundOpenInfo,
84-
>,
77+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
8578
) {
8679
match event {
8780
ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound {

protocols/autonat/src/v2/server/handler/dial_request.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ where
8181
type InboundOpenInfo = ();
8282
type OutboundOpenInfo = ();
8383

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

8888
fn poll(
8989
&mut self,
9090
cx: &mut Context<'_>,
91-
) -> Poll<
92-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
93-
> {
91+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
9492
loop {
9593
match self.inbound.poll_unpin(cx) {
9694
Poll::Ready(Ok(event)) => {
@@ -117,12 +115,7 @@ where
117115

118116
fn on_connection_event(
119117
&mut self,
120-
event: ConnectionEvent<
121-
Self::InboundProtocol,
122-
Self::OutboundProtocol,
123-
Self::InboundOpenInfo,
124-
Self::OutboundOpenInfo,
125-
>,
118+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
126119
) {
127120
match event {
128121
ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound {

protocols/dcutr/src/handler/relayed.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub struct Handler {
6565
queued_events: VecDeque<
6666
ConnectionHandlerEvent<
6767
<Self as ConnectionHandler>::OutboundProtocol,
68-
<Self as ConnectionHandler>::OutboundOpenInfo,
68+
(),
6969
<Self as ConnectionHandler>::ToBehaviour,
7070
>,
7171
>,
@@ -98,10 +98,7 @@ impl Handler {
9898
&mut self,
9999
FullyNegotiatedInbound {
100100
protocol: output, ..
101-
}: FullyNegotiatedInbound<
102-
<Self as ConnectionHandler>::InboundProtocol,
103-
<Self as ConnectionHandler>::InboundOpenInfo,
104-
>,
101+
}: FullyNegotiatedInbound<<Self as ConnectionHandler>::InboundProtocol>,
105102
) {
106103
match output {
107104
future::Either::Left(stream) => {
@@ -130,10 +127,7 @@ impl Handler {
130127
&mut self,
131128
FullyNegotiatedOutbound {
132129
protocol: stream, ..
133-
}: FullyNegotiatedOutbound<
134-
<Self as ConnectionHandler>::OutboundProtocol,
135-
<Self as ConnectionHandler>::OutboundOpenInfo,
136-
>,
130+
}: FullyNegotiatedOutbound<<Self as ConnectionHandler>::OutboundProtocol>,
137131
) {
138132
assert!(
139133
self.endpoint.is_listener(),
@@ -156,7 +150,7 @@ impl Handler {
156150
fn on_listen_upgrade_error(
157151
&mut self,
158152
ListenUpgradeError { error, .. }: ListenUpgradeError<
159-
<Self as ConnectionHandler>::InboundOpenInfo,
153+
(),
160154
<Self as ConnectionHandler>::InboundProtocol,
161155
>,
162156
) {
@@ -168,7 +162,7 @@ impl Handler {
168162
fn on_dial_upgrade_error(
169163
&mut self,
170164
DialUpgradeError { error, .. }: DialUpgradeError<
171-
<Self as ConnectionHandler>::OutboundOpenInfo,
165+
(),
172166
<Self as ConnectionHandler>::OutboundProtocol,
173167
>,
174168
) {
@@ -196,7 +190,7 @@ impl ConnectionHandler for Handler {
196190
type OutboundOpenInfo = ();
197191
type InboundOpenInfo = ();
198192

199-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
193+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
200194
match self.endpoint {
201195
ConnectedPoint::Dialer { .. } => {
202196
SubstreamProtocol::new(Either::Left(ReadyUpgrade::new(PROTOCOL_NAME)), ())
@@ -236,9 +230,7 @@ impl ConnectionHandler for Handler {
236230
fn poll(
237231
&mut self,
238232
cx: &mut Context<'_>,
239-
) -> Poll<
240-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
241-
> {
233+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
242234
// Return queued events.
243235
if let Some(event) = self.queued_events.pop_front() {
244236
return Poll::Ready(event);
@@ -295,12 +287,7 @@ impl ConnectionHandler for Handler {
295287

296288
fn on_connection_event(
297289
&mut self,
298-
event: ConnectionEvent<
299-
Self::InboundProtocol,
300-
Self::OutboundProtocol,
301-
Self::InboundOpenInfo,
302-
Self::OutboundOpenInfo,
303-
>,
290+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
304291
) {
305292
match event {
306293
ConnectionEvent::FullyNegotiatedInbound(fully_negotiated_inbound) => {

protocols/gossipsub/src/handler.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ impl EnabledHandler {
198198
&mut self,
199199
FullyNegotiatedOutbound { protocol, .. }: FullyNegotiatedOutbound<
200200
<Handler as ConnectionHandler>::OutboundProtocol,
201-
<Handler as ConnectionHandler>::OutboundOpenInfo,
202201
>,
203202
) {
204203
let (substream, peer_kind) = protocol;
@@ -221,7 +220,7 @@ impl EnabledHandler {
221220
) -> Poll<
222221
ConnectionHandlerEvent<
223222
<Handler as ConnectionHandler>::OutboundProtocol,
224-
<Handler as ConnectionHandler>::OutboundOpenInfo,
223+
(),
225224
<Handler as ConnectionHandler>::ToBehaviour,
226225
>,
227226
> {
@@ -427,7 +426,7 @@ impl ConnectionHandler for Handler {
427426
type OutboundOpenInfo = ();
428427
type OutboundProtocol = ProtocolConfig;
429428

430-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
429+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
431430
match self {
432431
Handler::Enabled(handler) => {
433432
SubstreamProtocol::new(either::Either::Left(handler.listen_protocol.clone()), ())
@@ -462,9 +461,7 @@ impl ConnectionHandler for Handler {
462461
fn poll(
463462
&mut self,
464463
cx: &mut Context<'_>,
465-
) -> Poll<
466-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
467-
> {
464+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
468465
match self {
469466
Handler::Enabled(handler) => handler.poll(cx),
470467
Handler::Disabled(DisabledHandler::ProtocolUnsupported { peer_kind_sent }) => {
@@ -483,12 +480,7 @@ impl ConnectionHandler for Handler {
483480

484481
fn on_connection_event(
485482
&mut self,
486-
event: ConnectionEvent<
487-
Self::InboundProtocol,
488-
Self::OutboundProtocol,
489-
Self::InboundOpenInfo,
490-
Self::OutboundOpenInfo,
491-
>,
483+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
492484
) {
493485
match self {
494486
Handler::Enabled(handler) => {

protocols/identify/src/handler.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ impl Handler {
159159
&mut self,
160160
FullyNegotiatedInbound {
161161
protocol: output, ..
162-
}: FullyNegotiatedInbound<
163-
<Self as ConnectionHandler>::InboundProtocol,
164-
<Self as ConnectionHandler>::InboundOpenInfo,
165-
>,
162+
}: FullyNegotiatedInbound<<Self as ConnectionHandler>::InboundProtocol>,
166163
) {
167164
match output {
168165
future::Either::Left(stream) => {
@@ -198,10 +195,7 @@ impl Handler {
198195
&mut self,
199196
FullyNegotiatedOutbound {
200197
protocol: output, ..
201-
}: FullyNegotiatedOutbound<
202-
<Self as ConnectionHandler>::OutboundProtocol,
203-
<Self as ConnectionHandler>::OutboundOpenInfo,
204-
>,
198+
}: FullyNegotiatedOutbound<<Self as ConnectionHandler>::OutboundProtocol>,
205199
) {
206200
match output {
207201
future::Either::Left(stream) => {
@@ -303,7 +297,7 @@ impl ConnectionHandler for Handler {
303297
type OutboundOpenInfo = ();
304298
type InboundOpenInfo = ();
305299

306-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
300+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
307301
SubstreamProtocol::new(
308302
SelectUpgrade::new(
309303
ReadyUpgrade::new(PROTOCOL_NAME),
@@ -334,7 +328,7 @@ impl ConnectionHandler for Handler {
334328
fn poll(
335329
&mut self,
336330
cx: &mut Context<'_>,
337-
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Event>> {
331+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Event>> {
338332
if let Some(event) = self.events.pop() {
339333
return Poll::Ready(event);
340334
}
@@ -413,12 +407,7 @@ impl ConnectionHandler for Handler {
413407

414408
fn on_connection_event(
415409
&mut self,
416-
event: ConnectionEvent<
417-
Self::InboundProtocol,
418-
Self::OutboundProtocol,
419-
Self::InboundOpenInfo,
420-
Self::OutboundOpenInfo,
421-
>,
410+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
422411
) {
423412
match event {
424413
ConnectionEvent::FullyNegotiatedInbound(fully_negotiated_inbound) => {

protocols/kad/src/handler.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,7 @@ impl Handler {
476476
FullyNegotiatedOutbound {
477477
protocol: stream,
478478
info: (),
479-
}: FullyNegotiatedOutbound<
480-
<Self as ConnectionHandler>::OutboundProtocol,
481-
<Self as ConnectionHandler>::OutboundOpenInfo,
482-
>,
479+
}: FullyNegotiatedOutbound<<Self as ConnectionHandler>::OutboundProtocol>,
483480
) {
484481
if let Some(sender) = self.pending_streams.pop_front() {
485482
let _ = sender.send(Ok(stream));
@@ -500,7 +497,6 @@ impl Handler {
500497
&mut self,
501498
FullyNegotiatedInbound { protocol, .. }: FullyNegotiatedInbound<
502499
<Self as ConnectionHandler>::InboundProtocol,
503-
<Self as ConnectionHandler>::InboundOpenInfo,
504500
>,
505501
) {
506502
// If `self.allow_listening` is false, then we produced a `DeniedUpgrade` and `protocol`
@@ -608,7 +604,7 @@ impl ConnectionHandler for Handler {
608604
type OutboundOpenInfo = ();
609605
type InboundOpenInfo = ();
610606

611-
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
607+
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol> {
612608
match self.mode {
613609
Mode::Server => SubstreamProtocol::new(Either::Left(self.protocol_config.clone()), ()),
614610
Mode::Client => SubstreamProtocol::new(Either::Right(upgrade::DeniedUpgrade), ()),
@@ -719,9 +715,7 @@ impl ConnectionHandler for Handler {
719715
fn poll(
720716
&mut self,
721717
cx: &mut Context<'_>,
722-
) -> Poll<
723-
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
724-
> {
718+
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
725719
loop {
726720
match &mut self.protocol_status {
727721
Some(status) if !status.reported => {
@@ -788,12 +782,7 @@ impl ConnectionHandler for Handler {
788782

789783
fn on_connection_event(
790784
&mut self,
791-
event: ConnectionEvent<
792-
Self::InboundProtocol,
793-
Self::OutboundProtocol,
794-
Self::InboundOpenInfo,
795-
Self::OutboundOpenInfo,
796-
>,
785+
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
797786
) {
798787
match event {
799788
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {

0 commit comments

Comments
 (0)