fix force_tcp flag: don't set UDPMux when enabled
@@ -54,17 +54,15 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
rtcConf.PacketBufferSize = 500
}
+ var udpMux *ice.UDPMuxDefault
+ var udpMuxConn *net.UDPConn
+ var err error
networkTypes := make([]webrtc.NetworkType, 0, 4)
+
if !rtcConf.ForceTCP {
networkTypes = append(networkTypes,
webrtc.NetworkTypeUDP4,
)
- }
-
- var udpMux *ice.UDPMuxDefault
- var udpMuxConn *net.UDPConn
- var err error
-
if rtcConf.ICEPortRangeStart != 0 && rtcConf.ICEPortRangeEnd != 0 {
if err := s.SetEphemeralUDPPortRange(uint16(rtcConf.ICEPortRangeStart), uint16(rtcConf.ICEPortRangeEnd)); err != nil {
return nil, err
@@ -97,6 +95,7 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
}
}
}
+ }
// use TCP mux when it's set
var tcpListener *net.TCPListener
