mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Unblock the data channel
This commit is contained in:
parent
860898b733
commit
10c9685a33
1 changed files with 7 additions and 1 deletions
|
@ -95,10 +95,15 @@ func datachannelHandler(conn *webRTCConn) {
|
||||||
conn.pr = pr
|
conn.pr = pr
|
||||||
|
|
||||||
dc := conn.dc
|
dc := conn.dc
|
||||||
|
dc.OnOpen = func() {
|
||||||
|
log.Println("OnOpen channel")
|
||||||
|
}
|
||||||
dc.OnClose = func() {
|
dc.OnClose = func() {
|
||||||
|
log.Println("OnClose channel")
|
||||||
pw.Close()
|
pw.Close()
|
||||||
}
|
}
|
||||||
dc.OnMessage = func(msg []byte) {
|
dc.OnMessage = func(msg []byte) {
|
||||||
|
log.Printf("OnMessage channel %d %q", len(msg), msg)
|
||||||
n, err := pw.Write(msg)
|
n, err := pw.Write(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pw.CloseWithError(err)
|
pw.CloseWithError(err)
|
||||||
|
@ -108,7 +113,7 @@ func datachannelHandler(conn *webRTCConn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyLoop(conn, or)
|
go copyLoop(conn, or)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makePeerConnection(config *webrtc.Configuration) (*webrtc.PeerConnection, error) {
|
func makePeerConnection(config *webrtc.Configuration) (*webrtc.PeerConnection, error) {
|
||||||
|
@ -196,6 +201,7 @@ func listenWebRTC(config *webrtc.Configuration, signal string) (*os.File, error)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go readSignalingMessages(signalChan, signalFile)
|
go readSignalingMessages(signalChan, signalFile)
|
||||||
|
log.Printf("waiting for offer")
|
||||||
return signalFile, nil
|
return signalFile, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue