mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Fix build failed on windows
Udp mux need retrieve destination address to dispatch received packet when listen at Any address. Windows use winsock APIs to get that, but conn.FD() is not implement for windows, so dispatch packet to first candidate, not ideally, but it will work for ice connectin, wasm will have same result too.
This commit is contained in:
+9
-2
@@ -365,12 +365,19 @@ func (m *UDPMuxDefault) connWorker() { //nolint:gocognit
|
||||
var destinationConn *udpMuxedConn
|
||||
m.addressMapMu.Lock()
|
||||
if conns, ok := m.addressMap[addr.String()]; ok {
|
||||
destinationConn = conns[ipAddr(localHost.String())]
|
||||
if localHost.IsUnspecified() {
|
||||
for _, c := range conns {
|
||||
destinationConn = c
|
||||
break
|
||||
}
|
||||
} else {
|
||||
destinationConn = conns[ipAddr(localHost.String())]
|
||||
}
|
||||
}
|
||||
m.addressMapMu.Unlock()
|
||||
|
||||
// If we haven't seen this address before but is a STUN packet lookup by ufrag
|
||||
if destinationConn == nil && stun.IsMessage(buf[:n]) {
|
||||
if destinationConn == nil && stun.IsMessage(buf[:n]) && !localHost.IsUnspecified() {
|
||||
msg := &stun.Message{
|
||||
Raw: append([]byte{}, buf[:n]...),
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//go:build !js
|
||||
//go:build !js && !windows
|
||||
|
||||
package ice
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build js
|
||||
//go:build js || windows
|
||||
|
||||
package ice
|
||||
|
||||
Reference in New Issue
Block a user