Open SyuTingSong opened 6 years ago
Maybe you can take a look of my branch : https://github.com/cs8425/smux/tree/implement-half-close I implement half-close feature but not fully tested if there were data racing.
也许你可以看看我的分支:https://github.com/cs8425/smux/tree/implement-half-close 我实现半关闭功能,但如果有数据竞争则没有完全测试。
你都改写了什么功能?最近也在用这个包,发现有Read Stream Error broken pipe 错误,不知道如何发生的。
@dotqi Read Stream回傳broken pipe的原因有很多 有正常的被close也有因為缺陷造成的不正常close 麻煩給更詳細資料 最好是簡單的demo code可以複現問題 至於我改了什麼功能請到PR https://github.com/xtaci/smux/pull/47#issuecomment-471889073
I am using smux.Stream for reading and writing in two concurrency goroutines. After all data written, the
stream.Close
is called for ending writing.The method stream.Read running at the local endpoint will get an error
broken pipe
immediately. Reading at the remote endpoint will getio.EOF
as expected. Even I callstream.Close
when EOF reached, the local endpoint still get the broken pipe error.I read the source code of smux. It seems that smux does not support half closing a stream. Any idea to avoid the broken pipe issue?