Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit f399ded

Browse files
committed
Terminate connections when they reach DC limit (#443)
(cherry picked from commit a8ef208) (cherry picked from commit 5aae0ce)
1 parent 177839f commit f399ded

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

wsnet/cache.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ func (d *DialerCache) evict() {
6565

6666
// If we're no longer signaling, the connection is pending close.
6767
evict := dialer.rtc.SignalingState() == webrtc.SignalingStateClosed
68+
69+
// HACK: since the pion package can't reuse data channel IDs we need
70+
// to terminate the connection once we approach the critical number.
71+
// We're working on adding data channel ID reuse support upstream.
72+
stats, ok := dialer.rtc.GetStats().GetConnectionStats(dialer.rtc)
73+
if ok && stats.DataChannelsRequested > 32500 {
74+
evict = true
75+
}
76+
6877
if dialer.activeConnections() == 0 && time.Since(d.atime[key]) >= d.ttl {
6978
evict = true
7079
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy