Skip to content

Commit

Permalink
修复在中断时发送数据会中断的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zanjie1999 committed May 17, 2021
1 parent 1936c10 commit cce8207
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tcp2ws.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tcp over WebSocket (tcp2ws)
// 基于ws的内网穿透工具
// Sparkle 20210430
// v3.4
// v3.5

package main

Expand Down Expand Up @@ -87,8 +87,12 @@ func ReadTcp2Ws(uuid string) (bool) {
// tcpConn.Close()
wsConn.Close()
// save send error buf
connMap[uuid].buf = buf[:length]
return true
if connMap[uuid].buf == nil{
connMap[uuid].buf = buf[:length]
} else {
append(connMap[uuid].buf, buf[:length])
}
// 此处无需中断 等着新的wsConn 或是被 断开连接 / 回收 即可
}
// if !isServer {
// log.Print(uuid, " send: ", length)
Expand Down

0 comments on commit cce8207

Please sign in to comment.