Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Jul 4, 2018
1 parent eaf836e commit 50886bd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion services/socks/socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
if outUDPConn != nil {
raddr = outUDPConn.RemoteAddr().String()
}
s.log.Printf("udp related tcp conn disconnected , %s -> %s", inconnRemoteAddr, raddr)
s.log.Printf("udp related tcp conn disconnected with read , %s -> %s", inconnRemoteAddr, raddr)
(*inConn).Close()
udpListener.Close()
s.userConns.Remove(inconnRemoteAddr)
Expand All @@ -572,6 +572,25 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
}
}
}()
go func() {
for {
if _, err := (*inConn).Write([]byte{0x00}); err != nil {
raddr := ""
if outUDPConn != nil {
raddr = outUDPConn.RemoteAddr().String()
}
s.log.Printf("udp related tcp conn disconnected with write , %s -> %s", inconnRemoteAddr, raddr)
(*inConn).Close()
udpListener.Close()
s.userConns.Remove(inconnRemoteAddr)
if outUDPConn != nil {
outUDPConn.Close()
}
return
}
time.Sleep(time.Second * 5)
}
}()
if *s.cfg.Parent != "" {
outconn, err := s.getOutConn(nil, nil, "", false)
if err != nil {
Expand Down

0 comments on commit 50886bd

Please sign in to comment.