[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Avoid double delay in client from ReconnectTimeout
commit 3e8947bfc9af1b299bc202d0252245c03ba20f11
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date: Fri Dec 4 13:41:11 2020 -0500
Avoid double delay in client from ReconnectTimeout
Run the snowflake collection ReconnectTimeout timer in parallel to the
negotiation with the broker. This way, if the broker takes a long time
to respond the client doesn't have to wait the full timeout to respond.
---
client/lib/snowflake.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go
index 171e173..10a2c0d 100644
--- a/client/lib/snowflake.go
+++ b/client/lib/snowflake.go
@@ -136,13 +136,13 @@ func Handler(socks net.Conn, tongue Tongue) error {
// transfer to the Tor SOCKS handler when needed.
func connectLoop(snowflakes SnowflakeCollector) {
for {
+ timer := time.After(ReconnectTimeout)
_, err := snowflakes.Collect()
if err != nil {
- log.Printf("WebRTC: %v Retrying in %v...",
- err, ReconnectTimeout)
+ log.Printf("WebRTC: %v Retrying...", err)
}
select {
- case <-time.After(ReconnectTimeout):
+ case <-timer:
continue
case <-snowflakes.Melted():
log.Println("ConnectLoop: stopped.")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits