mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Have SnowflakeConn.Close() return errors
Return an error if the connection was already closed. On the first close, return an error if any of the calls inside Close() returned an error in this order: - smux.Stream.Close() - pconn.Close() - smux.Session.Close()
This commit is contained in:
parent
a019fdaec9
commit
0d8bd159ec
1 changed files with 9 additions and 4 deletions
|
@ -243,14 +243,19 @@ type SnowflakeConn struct {
|
|||
//
|
||||
// The collection of snowflake proxies for this connection is stopped.
|
||||
func (conn *SnowflakeConn) Close() error {
|
||||
var err error
|
||||
log.Printf("---- SnowflakeConn: closed stream %v ---", conn.ID())
|
||||
conn.Stream.Close()
|
||||
err = conn.Stream.Close()
|
||||
log.Printf("---- SnowflakeConn: end collecting snowflakes ---")
|
||||
conn.snowflakes.End()
|
||||
conn.pconn.Close()
|
||||
if inerr := conn.pconn.Close(); err == nil {
|
||||
err = inerr
|
||||
}
|
||||
log.Printf("---- SnowflakeConn: discarding finished session ---")
|
||||
conn.sess.Close()
|
||||
return nil // TODO: return errors if any of the above do
|
||||
if inerr := conn.sess.Close(); err == nil {
|
||||
err = inerr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// loop through all provided STUN servers until we exhaust the list or find
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue