diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index 2d715a9..34ed9bf 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -461,8 +461,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer( close(dataChan) pr, pw := io.Pipe() - conn := newWebRTCConn(pc, dc, pr, sf.bytesLogger) - conn.SetConnectionProtocol(dc.Protocol()) + conn := newWebRTCConn(pc, dc, pr, sf.bytesLogger, dc.Protocol()) dc.SetBufferedAmountLowThreshold(bufferedAmountLowThreshold) diff --git a/proxy/lib/webrtcconn.go b/proxy/lib/webrtcconn.go index f2381bf..42fb54b 100644 --- a/proxy/lib/webrtcconn.go +++ b/proxy/lib/webrtcconn.go @@ -45,7 +45,7 @@ type webRTCConn struct { protocol string } -func newWebRTCConn(pc *webrtc.PeerConnection, dc *webrtc.DataChannel, pr *io.PipeReader, bytesLogger bytesLogger) *webRTCConn { +func newWebRTCConn(pc *webrtc.PeerConnection, dc *webrtc.DataChannel, pr *io.PipeReader, bytesLogger bytesLogger, protocol string) *webRTCConn { conn := &webRTCConn{pc: pc, dc: dc, pr: pr, bytesLogger: bytesLogger} conn.isClosing = false conn.activity = make(chan struct{}, 100) @@ -53,6 +53,7 @@ func newWebRTCConn(pc *webrtc.PeerConnection, dc *webrtc.DataChannel, pr *io.Pip conn.inactivityTimeout = 30 * time.Second ctx, cancel := context.WithCancel(context.Background()) conn.cancelTimeoutLoop = cancel + conn.protocol = protocol go conn.timeoutLoop(ctx) return conn } @@ -139,10 +140,6 @@ func (c *webRTCConn) SetWriteDeadline(t time.Time) error { return fmt.Errorf("SetWriteDeadline not implemented") } -func (c *webRTCConn) SetConnectionProtocol(protocol string) { - c.protocol = protocol -} - func (c *webRTCConn) GetConnectionProtocol() string { return c.protocol }