[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit bcc162898a9b085d8543e1aaeff7950b4431c5f3
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
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

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits