Skip to content

Commit d7b7f2c

Browse files
authored
Don't use a newer Rust method. (#115)
1 parent 43382d9 commit d7b7f2c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

web-transport-ws/src/session.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ where
152152
return Err(Error::InvalidStreamId);
153153
}
154154

155-
let mut state = match self.recv_streams.entry(stream.id) {
155+
match self.recv_streams.entry(stream.id) {
156156
hash_map::Entry::Vacant(e) => {
157157
if self.is_server == stream.id.server_initiated() {
158158
// Already closed, ignore it. TODO slightly wrong
@@ -208,16 +208,21 @@ where
208208
}
209209
};
210210

211-
e.insert_entry(recv_backend)
211+
let fin = stream.fin;
212+
recv_backend.inbound_data.send(stream).ok();
213+
214+
if !fin {
215+
e.insert(recv_backend);
216+
}
217+
}
218+
hash_map::Entry::Occupied(mut e) => {
219+
let fin = stream.fin;
220+
e.get_mut().inbound_data.send(stream).ok();
221+
if fin {
222+
e.remove();
223+
}
212224
}
213-
hash_map::Entry::Occupied(e) => e,
214225
};
215-
216-
let fin = stream.fin;
217-
state.get_mut().inbound_data.send(stream).ok();
218-
if fin {
219-
state.remove();
220-
}
221226
}
222227
Frame::ResetStream(reset) => {
223228
if !reset.id.can_recv(self.is_server) {

0 commit comments

Comments
 (0)