mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Wait for data channel OnOpen before returning from NewWebRTCPeer.
Now callers cannot call Write without there being a DataChannel to write to. This lets us remove the internal buffer and checks for transport == nil. Don't set internal fields like writePipe, transport, and pc to nil when closing; just close them and let them return errors if further calls are made on them. There's now a constant DataChannelTimeout that's separate from SnowflakeTimeout (the latter is what checkForStaleness uses). Now we can set DataChannel timeout to a lower value, to quickly dispose of unconnectable proxies, while still keeping the threshold for detecting the failure of a once-working proxy at 30 seconds. https://bugs.torproject.org/33897
This commit is contained in:
parent
e8c41650ae
commit
047d3214bf
2 changed files with 26 additions and 72 deletions
|
@ -17,6 +17,8 @@ import (
|
|||
const (
|
||||
ReconnectTimeout = 10 * time.Second
|
||||
SnowflakeTimeout = 30 * time.Second
|
||||
// How long to wait for the OnOpen callback on a DataChannel.
|
||||
DataChannelTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
type dummyAddr struct{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue