xtaci / smux

A Stream Multiplexing Library for golang with least memory usage(TDMA)
MIT License
1.27k stars 189 forks source link

Corrupt stream after expired WriteDeadline #51

Open ltucker opened 5 years ago

ltucker commented 5 years ago

If you set a write deadline and it expires, Write may return an incorrect number of bytes written (It always returns 0 although some may have actually succeeded anyway since the write goes on a request queue for the sendLoop). This effectively corrupts the stream from the client perspective.

Here is an echo test that demonstrates: https://gist.github.com/ltucker/e63cdd323ed8480d606d809467f45f93 And a branch with the test here: https://github.com/ltucker/smux/tree/bigwritedeadline

This may be expected behavior? (eg tls.Conn is considered corrupt after a write deadline expires) -- it's not documented as such, so I expected this to work.