Fix udpmux not work on AWS/ECS

ECS network might not set destination address of udp packet
to local address, so we can't only rely on it to dispatch
packet.
This commit is contained in:
cnderrauber
2022-10-08 10:50:19 +08:00
committed by cnderrauber
parent a705a5f294
commit af9281dc76
+2 -3
View File
@@ -365,13 +365,12 @@ func (m *UDPMuxDefault) connWorker() { //nolint:gocognit
var destinationConn *udpMuxedConn
m.addressMapMu.Lock()
if conns, ok := m.addressMap[addr.String()]; ok {
if localHost.IsUnspecified() {
destinationConn, ok = conns[ipAddr(localHost.String())]
if !ok {
for _, c := range conns {
destinationConn = c
break
}
} else {
destinationConn = conns[ipAddr(localHost.String())]
}
}
m.addressMapMu.Unlock()