ginuerzh / gost

GO Simple Tunnel - a simple tunnel written in golang
MIT License
15.45k stars 2.42k forks source link

fix: close pipe after transport in socks bind #999

Closed hunshcn closed 6 months ago

hunshcn commented 6 months ago

大致逻辑: 在 bind 连接成功建立之后 client <-> (gost: pc1 <-> pc2) <-> server

client <-> pc1pc2 <-> server 直接的 <-> 均为双向 io.Copy

pc2 <-> server 连接断开,pc2 需要手动关闭。否则若 client <-> pc1 在极低速网络中,这两者之间的双向 io.Copy 有较大可能处在 pc1.Write()pc1.Read(),此时 pc2 <-> server 连接断开,pc2 未被 close,pc1 的 write 和 read 将永远 hang 住。

ginuerzh commented 6 months ago

pc2在创建后已经derfer Close: https://github.com/ginuerzh/gost/pull/999/files#diff-18b9afacb495197e1b5c640d4a93c03be85e3c7eb5669150ad3caf4bce5dad10R1080

hunshcn commented 6 months ago

..确实,抱歉没看到