-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Hi all!
I tried to use your library for my simple project related to sending files.
I have the code looking like stream.write_all(...).await
. The problem is that when the self.send_window == 0
the writer waits until it is waken up by handle_window_update
. The window update is actually being received by the session
and successfully sent to frame_receiver
channel. But because nobody is reading this (i.e. nobody is actually polling the stream), the window can't be updated and the write
is stuck forever.
I looked in other solution related to Yamux in Rust (https://github.com/libp2p/rust-yamux), and it seems they actually solve this problem by updating windows on the "session" side not on the stream side (see below), so you don't need to poll the stream, the "session" side manages the window frames (so I assume my code would work as it is, I will try to do it to confirm).
if let Some(s) = self.streams.get_mut(&stream_id) {
let mut shared = s.lock();
shared.increase_send_window_by(frame.header().credit());
if is_finish {
shared.update_state(self.id, stream_id, State::RecvClosed);
if let Some(w) = shared.reader.take() {
w.wake()
}
}
if let Some(w) = shared.writer.take() {
w.wake()
}
}
Please correct me if I'm missing something, thanks!