Commit 8e568b64 authored by rui.zheng's avatar rui.zheng

close tunnel properly

parent 573d31ae
......@@ -210,6 +210,7 @@ func handleSocks5(conn net.Conn) {
log.Println(err)
return
}
defer sconn.Close()
switch req.Cmd {
case gosocks5.CmdConnect, gosocks5.CmdBind:
......@@ -326,6 +327,7 @@ func handleHttp(req *http.Request, conn net.Conn) {
log.Println(err)
return
}
defer sconn.Close()
if err := r.Write(sconn); err != nil {
return
......@@ -366,6 +368,7 @@ func handleShadow(conn net.Conn) {
log.Println(err)
return
}
defer sconn.Close()
req := gosocks5.NewRequest(gosocks5.CmdConnect, addr)
if err := req.Write(sconn); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment