Disable active TCP (#1726)

Active TCP was added in pion/ice v2.3.4. This is causing a couple of issues for us.

Active TCP does not make sense for an SFU. Clients are expected to be behind NAT and we should not be dialing them. Instead, LiveKit exposes a TCP port so clients could dial in
Active TCP is causing all iOS clients to become disconnected immediately. This is impacting all version of libwebrtc-based iOS clients (tested from M104 to M111)
This commit is contained in:
David Zhao
2023-05-19 23:00:06 -07:00
committed by GitHub
parent 3de51181ec
commit 5260907ffe

View File

@@ -1478,11 +1478,16 @@ func (t *PCTransport) handleLocalICECandidate(e *event) error {
c := e.data.(*webrtc.ICECandidate)
filtered := false
if t.preferTCP.Load() && c != nil && c.Protocol != webrtc.ICEProtocolTCP {
cstr := c.String()
t.params.Logger.Debugw("filtering out local candidate", "candidate", cstr)
t.filteredLocalCandidates = append(t.filteredLocalCandidates, cstr)
filtered = true
if c != nil {
if t.preferTCP.Load() && c.Protocol != webrtc.ICEProtocolTCP {
cstr := c.String()
t.params.Logger.Debugw("filtering out local candidate", "candidate", cstr)
t.filteredLocalCandidates = append(t.filteredLocalCandidates, cstr)
filtered = true
} else if c.Protocol == webrtc.ICEProtocolTCP && c.TCPType == ice.TCPTypeActive.String() {
// SFU should not support TCP active candidates. clients should connect to us
filtered = true
}
}
if filtered {
@@ -1512,6 +1517,11 @@ func (t *PCTransport) handleRemoteICECandidate(e *event) error {
t.params.Logger.Debugw("filtering out remote candidate", "candidate", c.Candidate)
t.filteredRemoteCandidates = append(t.filteredRemoteCandidates, c.Candidate)
filtered = true
} else if candidate, err := ice.UnmarshalCandidate(c.Candidate); err == nil {
if candidate != nil && candidate.TCPType() == ice.TCPTypePassive {
// SFU should ignore client's passive TCP, so Pion doesn't attempt to connect to it
filtered = true
}
}
if filtered {