mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -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)
|
close(dataChan)
|
||||||
|
|
||||||
pr, pw := io.Pipe()
|
pr, pw := io.Pipe()
|
||||||
conn := newWebRTCConn(pc, dc, pr, sf.bytesLogger)
|
conn := newWebRTCConn(pc, dc, pr, sf.bytesLogger, dc.Protocol())
|
||||||
conn.SetConnectionProtocol(dc.Protocol())
|
|
||||||
|
|
||||||
dc.SetBufferedAmountLowThreshold(bufferedAmountLowThreshold)
|
dc.SetBufferedAmountLowThreshold(bufferedAmountLowThreshold)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ type webRTCConn struct {
|
||||||
protocol string
|
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 := &webRTCConn{pc: pc, dc: dc, pr: pr, bytesLogger: bytesLogger}
|
||||||
conn.isClosing = false
|
conn.isClosing = false
|
||||||
conn.activity = make(chan struct{}, 100)
|
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
|
conn.inactivityTimeout = 30 * time.Second
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
conn.cancelTimeoutLoop = cancel
|
conn.cancelTimeoutLoop = cancel
|
||||||
|
conn.protocol = protocol
|
||||||
go conn.timeoutLoop(ctx)
|
go conn.timeoutLoop(ctx)
|
||||||
return conn
|
return conn
|
||||||
}
|
}
|
||||||
|
@ -139,10 +140,6 @@ func (c *webRTCConn) SetWriteDeadline(t time.Time) error {
|
||||||
return fmt.Errorf("SetWriteDeadline not implemented")
|
return fmt.Errorf("SetWriteDeadline not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *webRTCConn) SetConnectionProtocol(protocol string) {
|
|
||||||
c.protocol = protocol
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *webRTCConn) GetConnectionProtocol() string {
|
func (c *webRTCConn) GetConnectionProtocol() string {
|
||||||
return c.protocol
|
return c.protocol
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue