File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11## 0.17.3
22- Use ` web-time ` instead of ` instant ` .
33 See [ PR 5347] ( https://github.com/libp2p/rust-libp2p/pull/5347 ) .
4+ - Add resource limits to ` CircuitReq ` to be set
5+ See [ PR 5493] ( https://github.com/libp2p/rust-libp2p/pull/5493 )
46
57## 0.17.2
68
Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ impl ReservationReq {
115115pub struct CircuitReq {
116116 dst : PeerId ,
117117 substream : Framed < Stream , quick_protobuf_codec:: Codec < proto:: HopMessage > > ,
118+ max_circuit_duration : Duration ,
119+ max_circuit_bytes : u64 ,
118120}
119121
120122impl CircuitReq {
@@ -127,7 +129,15 @@ impl CircuitReq {
127129 type_pb : proto:: HopMessageType :: STATUS ,
128130 peer : None ,
129131 reservation : None ,
130- limit : None ,
132+ limit : Some ( proto:: Limit {
133+ duration : Some (
134+ self . max_circuit_duration
135+ . as_secs ( )
136+ . try_into ( )
137+ . expect ( "`max_circuit_duration` not to exceed `u32::MAX`." ) ,
138+ ) ,
139+ data : Some ( self . max_circuit_bytes ) ,
140+ } ) ,
131141 status : Some ( proto:: Status :: OK ) ,
132142 } ;
133143
@@ -204,7 +214,12 @@ pub(crate) async fn handle_inbound_request(
204214
205215 let dst = peer_id_res. map_err ( |_| Error :: ParsePeerId ) ?;
206216
207- Either :: Right ( CircuitReq { dst, substream } )
217+ Either :: Right ( CircuitReq {
218+ dst,
219+ substream,
220+ max_circuit_duration,
221+ max_circuit_bytes,
222+ } )
208223 }
209224 Type :: STATUS => return Err ( Error :: UnexpectedTypeStatus ) ,
210225 } ;
You can’t perform that action at this time.
0 commit comments