fix:bind local udp port error causes program to crash

This commit is contained in:
cnlh 2020-02-10 16:22:56 +08:00
parent 1be9e5472f
commit dc9eea6cc7
1 changed files with 1 additions and 1 deletions

View File

@ -216,12 +216,12 @@ func (s *TRPClient) handleChan(src net.Conn) {
func (s *TRPClient) handleUdp(serverConn net.Conn) {
// bind a local udp port
local, err := net.ListenUDP("udp", nil)
defer local.Close()
defer serverConn.Close()
if err != nil {
logs.Error("bind local udp port error ", err.Error())
return
}
defer local.Close()
go func() {
defer serverConn.Close()
b := common.BufPoolUdp.Get().([]byte)