mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
webRTCConn close as part of its reset, instead of depending on external deferred close after receiving reset channel, allows valid disconnections even before use
This commit is contained in:
parent
bc1a499bc8
commit
1d1882b59d
2 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ import (
|
||||||
var ptInfo pt.ClientInfo
|
var ptInfo pt.ClientInfo
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ReconnectTimeout = 5
|
ReconnectTimeout = 10
|
||||||
SnowflakeCapacity = 3
|
SnowflakeCapacity = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ func handler(conn *pt.SocksConn) error {
|
||||||
conn.Reject()
|
conn.Reject()
|
||||||
return errors.New("handler: Received invalid Snowflake")
|
return errors.New("handler: Received invalid Snowflake")
|
||||||
}
|
}
|
||||||
defer remote.Close()
|
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
log.Println("handler: Snowflake assigned.")
|
log.Println("handler: Snowflake assigned.")
|
||||||
|
|
||||||
|
|
|
@ -291,13 +291,14 @@ func (c *webRTCConn) Reset() {
|
||||||
c.reset <- struct{}{}
|
c.reset <- struct{}{}
|
||||||
log.Println("WebRTC resetting...")
|
log.Println("WebRTC resetting...")
|
||||||
}()
|
}()
|
||||||
|
c.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *webRTCConn) cleanup() {
|
func (c *webRTCConn) cleanup() {
|
||||||
if nil != c.snowflake {
|
if nil != c.snowflake {
|
||||||
s := c.snowflake
|
s := c.snowflake
|
||||||
log.Printf("WebRTC: closing DataChannel")
|
log.Printf("WebRTC: closing DataChannel")
|
||||||
// Setting snowflak to nil *before* Close indicates to OnClose that it
|
// Setting snowflake to nil *before* Close indicates to OnClose that it
|
||||||
// was locally triggered.
|
// was locally triggered.
|
||||||
c.snowflake = nil
|
c.snowflake = nil
|
||||||
s.Close()
|
s.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue