Initialize SnowflakeListener.closed

Fixes a bug where an uninitialized channel causes a panic when closed
(#40099).
This commit is contained in:
Cecylia Bocovich 2022-02-08 13:00:43 -05:00
parent e6e5e20ae8
commit bcc162898a
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90

View file

@ -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