Skip to content
Snippets Groups Projects
Unverified Commit 8bcd437d authored by Wolfgang Welz's avatar Wolfgang Welz Committed by GitHub
Browse files

Fix: netutil.CheckUDP tests (#161)

parent b6beebfe
Branches
Tags
No related merge requests found
...@@ -87,7 +87,7 @@ func CheckUDP(local, remote *net.UDPAddr, checkAddress bool, checkPort bool) err ...@@ -87,7 +87,7 @@ func CheckUDP(local, remote *net.UDPAddr, checkAddress bool, checkPort bool) err
return errInvalidData return errInvalidData
} }
udpAddr := from.(*net.UDPAddr) udpAddr := from.(*net.UDPAddr)
if checkAddress && udpAddr.IP.Equal(remote.IP) { if checkAddress && !udpAddr.IP.Equal(remote.IP) {
return fmt.Errorf("IP changed: %s", udpAddr.IP) return fmt.Errorf("IP changed: %s", udpAddr.IP)
} }
if checkPort && udpAddr.Port != remote.Port { if checkPort && udpAddr.Port != remote.Port {
......
...@@ -59,7 +59,7 @@ func TestCheckUDP(t *testing.T) { ...@@ -59,7 +59,7 @@ func TestCheckUDP(t *testing.T) {
} }
func getLocalUDPAddr() (*net.UDPAddr, error) { func getLocalUDPAddr() (*net.UDPAddr, error) {
addr, err := net.ResolveUDPAddr("udp", ":0") addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment