mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
fix(proxy): remove _potential_ deadlock
The `dc.Send()` should increase the `bufferedAmount` value, so there is no need to add the message length a second time. Also replace GT with GE, for the case where `BufferedAmountLowThreshold === maxBufferedAmount` Currently the deadlock cannot happen because `maxBufferedAmount` and `BufferedAmountLowThreshold` are too far apart, in fact the former is 2x the latter. See - https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/144#note_2902956 - https://github.com/pion/webrtc/pull/2473 - https://github.com/pion/webrtc/pull/2474
This commit is contained in:
parent
d434549df8
commit
a615e8b1ab
1 changed files with 1 additions and 1 deletions
|
@ -91,7 +91,7 @@ func (c *webRTCConn) Write(b []byte) (int, error) {
|
||||||
defer c.lock.Unlock()
|
defer c.lock.Unlock()
|
||||||
if c.dc != nil {
|
if c.dc != nil {
|
||||||
c.dc.Send(b)
|
c.dc.Send(b)
|
||||||
if !c.isClosing && c.dc.BufferedAmount()+uint64(len(b)) > maxBufferedAmount {
|
if !c.isClosing && c.dc.BufferedAmount() >= maxBufferedAmount {
|
||||||
<-c.sendMoreCh
|
<-c.sendMoreCh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue