add return when utpsock's err is not nil

This commit is contained in:
lovedboy 2016-05-24 13:24:29 +08:00
parent 0b36de4be9
commit ca8d9de944
1 changed files with 1 additions and 0 deletions

View File

@ -235,6 +235,7 @@ func listen(tcp, utp bool, networkSuffix, addr string) (tcpL net.Listener, utpSo
utpSock, err = listenUTP(networkSuffix, addr)
if err != nil && tcp {
tcpL.Close()
return
}
listenedAddr = utpSock.Addr().String()
}