@@ -136,12 +136,12 @@ impl P2pNetworkYamuxState {
136
136
}
137
137
138
138
match & frame. inner {
139
- YamuxFrameInner :: Data ( data ) => {
139
+ YamuxFrameInner :: Data ( _ ) => {
140
140
if let Some ( stream) = yamux_state. streams . get_mut ( & frame. stream_id ) {
141
141
// must not underflow
142
142
// TODO: check it and disconnect peer that violates flow rules
143
143
stream. window_ours =
144
- stream. window_ours . saturating_sub ( data . len ( ) as u32 ) ;
144
+ stream. window_ours . saturating_sub ( frame . len_as_u32 ( ) ) ;
145
145
}
146
146
}
147
147
YamuxFrameInner :: WindowUpdate { difference } => {
@@ -157,7 +157,7 @@ impl P2pNetworkYamuxState {
157
157
// try send as many frames as can
158
158
let mut window = stream. window_theirs ;
159
159
while let Some ( frame) = stream. pending . pop_front ( ) {
160
- let len = frame. len ( ) as u32 ;
160
+ let len = frame. len_as_u32 ( ) ;
161
161
pending_outgoing. push_back ( frame) ;
162
162
if let Some ( new_window) = window. checked_sub ( len) {
163
163
window = new_window;
@@ -285,9 +285,9 @@ impl P2pNetworkYamuxState {
285
285
return Ok ( ( ) ) ;
286
286
} ;
287
287
match & mut frame. inner {
288
- YamuxFrameInner :: Data ( data ) => {
288
+ YamuxFrameInner :: Data ( _ ) => {
289
289
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 ( ) )
291
291
{
292
292
// their window is big enough, decrease the size
293
293
// and send the whole frame
0 commit comments