File tree 3 files changed +39
-12
lines changed
3 files changed +39
-12
lines changed Original file line number Diff line number Diff line change 16
16
[ issue 2217 ] : https://github.com/libp2p/rust-libp2p/issues/2217
17
17
[ PR 3214 ] : https://github.com/libp2p/rust-libp2p/pull/3214
18
18
19
+ # 0.8.1
20
+
21
+ - Skip unparsable multiaddr in ` InboundUpgrade::upgrade_inbound ` and
22
+ ` OutboundUpgrade::upgrade_outbound ` . See [ PR 3300] .
23
+
24
+ [ PR 3300 ] : https://github.com/libp2p/rust-libp2p/pull/3300
25
+
19
26
# 0.8.0
20
27
21
28
- Update to ` prost-codec ` ` v0.3.0 ` .
Original file line number Diff line number Diff line change @@ -58,14 +58,23 @@ impl upgrade::InboundUpgrade<NegotiatedSubstream> for Upgrade {
58
58
} else {
59
59
obs_addrs
60
60
. into_iter ( )
61
- . map ( Multiaddr :: try_from)
61
+ . filter_map ( |a| match Multiaddr :: try_from ( a) {
62
+ Ok ( a) => Some ( a) ,
63
+ Err ( e) => {
64
+ log:: debug!( "Unable to parse multiaddr: {e}" ) ;
65
+ None
66
+ }
67
+ } )
62
68
// Filter out relayed addresses.
63
- . filter ( |a| match a {
64
- Ok ( a) => !a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) ,
65
- Err ( _) => true ,
69
+ . filter ( |a| {
70
+ if a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) {
71
+ log:: debug!( "Dropping relayed address {a}" ) ;
72
+ false
73
+ } else {
74
+ true
75
+ }
66
76
} )
67
- . collect :: < Result < Vec < Multiaddr > , _ > > ( )
68
- . map_err ( |_| UpgradeError :: InvalidAddrs ) ?
77
+ . collect :: < Vec < Multiaddr > > ( )
69
78
} ;
70
79
71
80
let r#type = hole_punch:: Type :: from_i32 ( r#type) . ok_or ( UpgradeError :: ParseTypeField ) ?;
@@ -124,6 +133,7 @@ pub enum UpgradeError {
124
133
StreamClosed ,
125
134
#[ error( "Expected at least one address in reservation." ) ]
126
135
NoAddresses ,
136
+ #[ deprecated( since = "0.8.1" , note = "Error is no longer constructed." ) ]
127
137
#[ error( "Invalid addresses." ) ]
128
138
InvalidAddrs ,
129
139
#[ error( "Failed to parse response type field." ) ]
Original file line number Diff line number Diff line change @@ -85,14 +85,23 @@ impl upgrade::OutboundUpgrade<NegotiatedSubstream> for Upgrade {
85
85
} else {
86
86
obs_addrs
87
87
. into_iter ( )
88
- . map ( Multiaddr :: try_from)
88
+ . filter_map ( |a| match Multiaddr :: try_from ( a) {
89
+ Ok ( a) => Some ( a) ,
90
+ Err ( e) => {
91
+ log:: debug!( "Unable to parse multiaddr: {e}" ) ;
92
+ None
93
+ }
94
+ } )
89
95
// Filter out relayed addresses.
90
- . filter ( |a| match a {
91
- Ok ( a) => !a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) ,
92
- Err ( _) => true ,
96
+ . filter ( |a| {
97
+ if a. iter ( ) . any ( |p| p == Protocol :: P2pCircuit ) {
98
+ log:: debug!( "Dropping relayed address {a}" ) ;
99
+ false
100
+ } else {
101
+ true
102
+ }
93
103
} )
94
- . collect :: < Result < Vec < Multiaddr > , _ > > ( )
95
- . map_err ( |_| UpgradeError :: InvalidAddrs ) ?
104
+ . collect :: < Vec < Multiaddr > > ( )
96
105
} ;
97
106
98
107
let msg = HolePunch {
@@ -128,6 +137,7 @@ pub enum UpgradeError {
128
137
NoAddresses ,
129
138
#[ error( "Invalid expiration timestamp in reservation." ) ]
130
139
InvalidReservationExpiration ,
140
+ #[ deprecated( since = "0.8.1" , note = "Error is no longer constructed." ) ]
131
141
#[ error( "Invalid addresses in reservation." ) ]
132
142
InvalidAddrs ,
133
143
#[ error( "Failed to parse response type field." ) ]
You can’t perform that action at this time.
0 commit comments