Browse Source

was missing Grant() step in sock proxy connection handler

Rod Hynes 11 years ago
parent
commit
6cca602e4a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      psiphon/socksProxy.go

+ 5 - 2
psiphon/socksProxy.go

@@ -68,12 +68,15 @@ func (server *SocksServer) Close() {
 
 func socksConnectionHandler(tunnel *Tunnel, localSocksConn *pt.SocksConn) (err error) {
 	defer localSocksConn.Close()
-	remoteAddr := localSocksConn.Req.Target
-	remoteSshForward, err := tunnel.sshClient.Dial("tcp", remoteAddr)
+	remoteSshForward, err := tunnel.sshClient.Dial("tcp", localSocksConn.Req.Target)
 	if err != nil {
 		return err
 	}
 	defer remoteSshForward.Close()
+	err = localSocksConn.Grant(&net.TCPAddr{IP: net.ParseIP("0.0.0.0"), Port: 0})
+	if err != nil {
+		return err
+	}
 	// TODO: page view stats would be done here
 	// TODO: poll quit signal (x, ok := <-ch)
 	waitGroup := new(sync.WaitGroup)