From: Matt Joiner Date: Sun, 3 May 2020 08:39:16 +0000 (+1000) Subject: Limit the write buffer to work around a webrtc datachannel issue X-Git-Tag: v1.16.0~40 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=dad5ab89a58be8c755ea6ef87b4bb6dbaefb5589;p=btrtrc.git Limit the write buffer to work around a webrtc datachannel issue https://github.com/pion/datachannel/issues/59. Fixes https://github.com/anacrolix/torrent/issues/402. --- diff --git a/peerconn.go b/peerconn.go index 0e267a78..3e18544b 100644 --- a/peerconn.go +++ b/peerconn.go @@ -601,7 +601,9 @@ func (cn *PeerConn) writer(keepAliveTimeout time.Duration) { cn.wroteMsg(&msg) cn.writeBuffer.Write(msg.MustMarshalBinary()) torrent.Add(fmt.Sprintf("messages filled of type %s", msg.Type.String()), 1) - return cn.writeBuffer.Len() < 1<<16 // 64KiB + // 64KiB, but temporarily less to work around an issue with WebRTC. TODO: Update + // when https://github.com/pion/datachannel/issues/59 is fixed. + return cn.writeBuffer.Len() < 1<<15 }) } if cn.writeBuffer.Len() == 0 && time.Since(lastWrite) >= keepAliveTimeout {