mirror of
https://github.com/openp2p-cn/openp2p.git
synced 2026-11-10 15:59:38 +08:00
Update nat.go
This commit is contained in:
@@ -113,7 +113,6 @@ func getNATType(host string, udp1 int, udp2 int) (publicIP string, NATType int,
|
||||
|
||||
func publicIPTest(publicIP string, echoPort int) (hasPublicIP int, hasUPNPorNATPMP int) {
|
||||
var echoConn *net.UDPConn
|
||||
//This piece is in another goroutine in the old code! Please check the update diary.
|
||||
gLog.Println(LvDEBUG, "echo server start")
|
||||
var err error
|
||||
echoConn, err = net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: echoPort})
|
||||
@@ -125,7 +124,6 @@ func publicIPTest(publicIP string, echoPort int) (hasPublicIP int, hasUPNPorNATP
|
||||
go func() {
|
||||
// close outside for breaking the ReadFromUDP
|
||||
// wait 5s(30s?) for echo testing
|
||||
gLog.Println(LvDEBUG, "the own goroutine of echo server run")
|
||||
buf := make([]byte, 1600)
|
||||
echoConn.SetReadDeadline(time.Now().Add(time.Second * 30))
|
||||
n, addr, err := echoConn.ReadFromUDP(buf)
|
||||
|
||||
Reference in New Issue
Block a user