@@ -136,12 +136,12 @@ impl P2pNetworkYamuxState {
136136 }
137137
138138 match & frame. inner {
139- YamuxFrameInner :: Data ( data ) => {
139+ YamuxFrameInner :: Data ( _ ) => {
140140 if let Some ( stream) = yamux_state. streams . get_mut ( & frame. stream_id ) {
141141 // must not underflow
142142 // TODO: check it and disconnect peer that violates flow rules
143143 stream. window_ours =
144- stream. window_ours . saturating_sub ( data . len ( ) as u32 ) ;
144+ stream. window_ours . saturating_sub ( frame . len_as_u32 ( ) ) ;
145145 }
146146 }
147147 YamuxFrameInner :: WindowUpdate { difference } => {
@@ -157,7 +157,7 @@ impl P2pNetworkYamuxState {
157157 // try send as many frames as can
158158 let mut window = stream. window_theirs ;
159159 while let Some ( frame) = stream. pending . pop_front ( ) {
160- let len = frame. len ( ) as u32 ;
160+ let len = frame. len_as_u32 ( ) ;
161161 pending_outgoing. push_back ( frame) ;
162162 if let Some ( new_window) = window. checked_sub ( len) {
163163 window = new_window;
@@ -285,9 +285,9 @@ impl P2pNetworkYamuxState {
285285 return Ok ( ( ) ) ;
286286 } ;
287287 match & mut frame. inner {
288- YamuxFrameInner :: Data ( data ) => {
288+ YamuxFrameInner :: Data ( _ ) => {
289289 if let Some ( new_window) =
290- stream. window_theirs . checked_sub ( data . len ( ) as u32 )
290+ stream. window_theirs . checked_sub ( frame . len_as_u32 ( ) )
291291 {
292292 // their window is big enough, decrease the size
293293 // and send the whole frame
0 commit comments