hashicorp / yamux

Golang connection multiplexing library
Mozilla Public License 2.0
2.24k stars 236 forks source link

add StreamCloseTimeout #88

Closed mitchellh closed 3 years ago

mitchellh commented 3 years ago

This adds a new setting StreamCloseTimeout which forcibly closes the connection if the remote side doesn't ACK a FIN within the given timeout. This should only happen in cases the remote side is buggy and doesn't call Close properly.

This allows the Session to release the mapping to the stream and therefore avoids a memory leak when one side of a stream never completes a close.

"Forcibly close" in this case means: (1) send a RST (2) delete the receive buffer (3) delete the stream. Future packets received for the stream will be dropped (and a log message produced).