mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
add protocol setting to newWebRTCConn
This commit is contained in:
parent
80262c9e4f
commit
b2605b7961
2 changed files with 3 additions and 7 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue