commit 9a7fcdec03b3bda87a4f1269558816513ce79f66 Author: Shelikhoo xiaokangwang@outlook.com Date: Mon Dec 13 14:25:41 2021 +0000
Add Snowflake Event Reporter for Peer Communication --- client/lib/webrtc.go | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go index 3b496d0..4068eb8 100644 --- a/client/lib/webrtc.go +++ b/client/lib/webrtc.go @@ -191,6 +191,7 @@ func (c *WebRTCPeer) preparePeerConnection(config *webrtc.Configuration) error { return err } dc.OnOpen(func() { + c.eventsLogger.OnNewSnowflakeEvent(&event.EventOnSnowflakeConnected{}) log.Println("WebRTC: DataChannel.OnOpen") close(c.open) }) @@ -198,6 +199,9 @@ func (c *WebRTCPeer) preparePeerConnection(config *webrtc.Configuration) error { log.Println("WebRTC: DataChannel.OnClose") c.Close() }) + dc.OnError(func(err error) { + c.eventsLogger.OnNewSnowflakeEvent(&event.EventOnSnowflakeConnectionFailed{Error: err}) + }) dc.OnMessage(func(msg webrtc.DataChannelMessage) { if len(msg.Data) <= 0 { log.Println("0 length message---")
tor-commits@lists.torproject.org