mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
fix: potential race conditions with non-local err
Some of the changes do not appear to have a potential race condition, so there it is purely a refactor, while in others (e.g. in broker.go and in proxy/lib/snowflake.go) we do use the same variable from multiple threads / functions.
This commit is contained in:
parent
01819eee32
commit
1923803124
5 changed files with 13 additions and 14 deletions
|
@ -504,8 +504,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(
|
|||
pw.Close()
|
||||
})
|
||||
dc.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||
var n int
|
||||
n, err = pw.Write(msg.Data)
|
||||
n, err := pw.Write(msg.Data)
|
||||
if err != nil {
|
||||
if inErr := pw.CloseWithError(err); inErr != nil {
|
||||
log.Printf("close with error generated an error: %v", inErr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue