Skip to content

Commit

Permalink
Limit the write buffer to work around a webrtc datachannel issue
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed May 3, 2020
1 parent 39171df commit dad5ab8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion peerconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dad5ab8

Please sign in to comment.