From 0f5a3030fb107720939837b5a6eb179cec8e601a Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 13 Sep 2021 17:42:39 +0000 Subject: [PATCH] Terminate connections when they reach DC limit --- wsnet/cache.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wsnet/cache.go b/wsnet/cache.go index b16950ca..fa5e561f 100644 --- a/wsnet/cache.go +++ b/wsnet/cache.go @@ -65,6 +65,15 @@ func (d *DialerCache) evict() { // If we're no longer signaling, the connection is pending close. evict := dialer.rtc.SignalingState() == webrtc.SignalingStateClosed + + // HACK: since the pion package can't reuse data channel IDs we need + // to terminate the connection once we approach the critical number. + // We're working on adding data channel ID reuse support upstream. + stats, ok := dialer.rtc.GetStats().GetConnectionStats(dialer.rtc) + if ok && stats.DataChannelsRequested > 32500 { + evict = true + } + if dialer.activeConnections() == 0 && time.Since(d.atime[key]) >= d.ttl { evict = true } else { 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