mirror of
https://github.com/n0-computer/noq.git
synced 2026-10-03 12:40:46 +00:00
connection: wake 'stopped' streams on stream finish events
In the event that the SendStream Stopped future is polled once and then dropped before the remote side has stopped the stream, and instead the stream has been finished, the waker registered in the connection stopped map is never removed and is effectively "leaked" until the connection is closed. This can lead to a large amount of memory being retained when a connection is very long lived and many streams are used over the life of that connection.
This commit is contained in:
committed by
Benjamin Saunders
parent
cfb7a067ee
commit
1122c627c3
@@ -966,6 +966,9 @@ impl State {
|
||||
// If the finishing stream was already dropped, there's nothing more to do.
|
||||
let _ = finishing.send(None);
|
||||
}
|
||||
if let Some(stopped) = self.stopped.remove(&id) {
|
||||
stopped.wake();
|
||||
}
|
||||
}
|
||||
Stream(StreamEvent::Stopped { id, error_code }) => {
|
||||
if let Some(stopped) = self.stopped.remove(&id) {
|
||||
|
||||
Reference in New Issue
Block a user