mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
fix(proxy): race condition warning for isClosing
It appears that there is no need for the `isClosing` var at all: we can just `close(c.sendMoreCh)` to ensure that it doesn't block any more `Write()`s. This is a follow-up to https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/144. Related: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/524.
This commit is contained in:
parent
1aa5a61fe8
commit
01819eee32
2 changed files with 5 additions and 9 deletions
|
@ -485,6 +485,10 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(
|
|||
}
|
||||
})
|
||||
dc.OnClose(func() {
|
||||
// Make sure that the `Write()`s are not blocked any more.
|
||||
dc.OnBufferedAmountLow(func() {})
|
||||
close(conn.sendMoreCh)
|
||||
|
||||
conn.lock.Lock()
|
||||
defer conn.lock.Unlock()
|
||||
log.Printf("Data Channel %s-%d close\n", dc.Label(), dc.ID())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue