libp2p / jvm-libp2p

a libp2p implementation for the JVM, written in Kotlin 🔥
https://libp2p.io
Apache License 2.0
270 stars 75 forks source link

Fix the case when a stream is closed while still having buffered data for write #330

Closed Nashatyrev closed 1 year ago

Nashatyrev commented 1 year ago

When a Stream is locally closed for writing but there is some data buffered for writing still, the YamuxHandler shouldn't immediately close the Stream for writing (by issuing FIN frame) and discarding the write buffer.

It should rather mark the Stream as closed for writing and wait for the suitable window update(s) to send the remaining data and only then issue a FIN frame.