mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add connection failure events for proxy timeouts
This change adds two new connection failure events for snowflake proxies. One fires when the datachannel times out and another fires when the connection to the proxy goes stale.
This commit is contained in:
parent
bcc162898a
commit
2c008d6589
1 changed files with 5 additions and 1 deletions
|
@ -129,6 +129,8 @@ func (c *WebRTCPeer) checkForStaleness(timeout time.Duration) {
|
|||
if time.Since(lastReceive) > timeout {
|
||||
log.Printf("WebRTC: No messages received for %v -- closing stale connection.",
|
||||
timeout)
|
||||
err := errors.New("no messages received, closing stale connection")
|
||||
c.eventsLogger.OnNewSnowflakeEvent(event.EventOnSnowflakeConnectionFailed{Error: err})
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
|
@ -174,7 +176,9 @@ func (c *WebRTCPeer) connect(config *webrtc.Configuration, broker *BrokerChannel
|
|||
case <-c.open:
|
||||
case <-time.After(DataChannelTimeout):
|
||||
c.transport.Close()
|
||||
return errors.New("timeout waiting for DataChannel.OnOpen")
|
||||
err = errors.New("timeout waiting for DataChannel.OnOpen")
|
||||
c.eventsLogger.OnNewSnowflakeEvent(event.EventOnSnowflakeConnectionFailed{Error: err})
|
||||
return err
|
||||
}
|
||||
|
||||
go c.checkForStaleness(SnowflakeTimeout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue