visitor: fix panic

This commit is contained in:
fatedier 2017-12-05 22:26:53 +08:00
parent ae9a4623d9
commit 1a6a179b68
1 changed files with 5 additions and 1 deletions

View File

@ -259,7 +259,11 @@ func (sv *XtcpVisitor) handleConn(userConn frpNet.Conn) {
sv.Trace("send all detect msg done") sv.Trace("send all detect msg done")
// Listen for visitorConn's address and wait for client connection. // Listen for visitorConn's address and wait for client connection.
lConn, _ := net.ListenUDP("udp", laddr) lConn, err := net.ListenUDP("udp", laddr)
if err != nil {
sv.Error("listen on visitorConn's local adress error: %v", err)
return
}
lConn.SetReadDeadline(time.Now().Add(5 * time.Second)) lConn.SetReadDeadline(time.Now().Add(5 * time.Second))
sidBuf := pool.GetBuf(1024) sidBuf := pool.GetBuf(1024)
n, _, err = lConn.ReadFromUDP(sidBuf) n, _, err = lConn.ReadFromUDP(sidBuf)