[tor-commits] [snowflake/main] Initialize SnowflakeListener.closed

cohosh at torproject.org cohosh at torproject.org
Fri Feb 11 14:20:37 UTC 2022


commit bcc162898a9b085d8543e1aaeff7950b4431c5f3
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Tue Feb 8 13:00:43 2022 -0500

    Initialize SnowflakeListener.closed
    
    Fixes a bug where an uninitialized channel causes a panic when closed
    (#40099).
---
 server/lib/snowflake.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/snowflake.go b/server/lib/snowflake.go
index a1051e0..44f287f 100644
--- a/server/lib/snowflake.go
+++ b/server/lib/snowflake.go
@@ -75,7 +75,11 @@ func NewSnowflakeServer(getCertificate func(*tls.ClientHelloInfo) (*tls.Certific
 // Listen starts a listener on addr that will accept both turbotunnel
 // and legacy Snowflake connections.
 func (t *Transport) Listen(addr net.Addr) (*SnowflakeListener, error) {
-	listener := &SnowflakeListener{addr: addr, queue: make(chan net.Conn, 65534)}
+	listener := &SnowflakeListener{
+		addr:   addr,
+		queue:  make(chan net.Conn, 65534),
+		closed: make(chan struct{}),
+	}
 
 	handler := httpHandler{
 		// pconn is shared among all connections to this server. It



More information about the tor-commits mailing list