add protocol setting to newWebRTCConn

This commit is contained in:
Shelikhoo 2024-09-17 15:39:11 +01:00 committed by WofWca
parent 80262c9e4f
commit b2605b7961
2 changed files with 3 additions and 7 deletions

View file

@ -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
}