mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Restore check for nil writePipe in WebRTCPeer.Close.
I removed this check in 047d3214bf
because
NewWebRTCPeer always initializes writePipe, and it is never reset to
nil. However tests used &WebRTCPeer{} which bypasses NewWebRTCPeer and
leaves writePipe set to nil.
https://bugs.torproject.org/34049#comment:3
https://bugs.torproject.org/34050
This commit is contained in:
parent
5e8f9ac538
commit
72cfb96ede
1 changed files with 3 additions and 1 deletions
|
@ -236,7 +236,9 @@ func exchangeSDP(broker *BrokerChannel, offer *webrtc.SessionDescription) *webrt
|
||||||
// Close all channels and transports
|
// Close all channels and transports
|
||||||
func (c *WebRTCPeer) cleanup() {
|
func (c *WebRTCPeer) cleanup() {
|
||||||
// Close this side of the SOCKS pipe.
|
// Close this side of the SOCKS pipe.
|
||||||
|
if c.writePipe != nil { // c.writePipe can be nil in tests.
|
||||||
c.writePipe.Close()
|
c.writePipe.Close()
|
||||||
|
}
|
||||||
if nil != c.transport {
|
if nil != c.transport {
|
||||||
log.Printf("WebRTC: closing DataChannel")
|
log.Printf("WebRTC: closing DataChannel")
|
||||||
c.transport.Close()
|
c.transport.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue