Close SocksConn when WebRTC connection is reset

* This will induce the tor client to establish a new SocksConn,
   which in turn will dial a new WebRTC connection.

   To be improved upon.

 * Part of #12
This commit is contained in:
Arlo Breault 2016-03-18 21:29:31 -07:00
parent cf1b0a49f1
commit 598e2a3bfb
2 changed files with 23 additions and 20 deletions

View file

@ -99,6 +99,12 @@ func handler(conn *pt.SocksConn) error {
defer remote.Close()
webrtcRemote = remote
// Induce another call to handler
go func() {
<-remote.reset
conn.Close()
}()
err = conn.Grant(&net.TCPAddr{IP: net.IPv4zero, Port: 0})
if err != nil {
return err