[tor-commits] [flashproxy/master] Set a socket deadline in PtConnectOr.

dcf at torproject.org dcf at torproject.org
Sun Feb 3 03:40:13 UTC 2013


commit f56178868ca38a5c75b697bb98855882197b2260
Author: David Fifield <david at bamsoftware.com>
Date:   Wed Jan 30 01:49:18 2013 -0800

    Set a socket deadline in PtConnectOr.
---
 websocket-transport/pt.go |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/websocket-transport/pt.go b/websocket-transport/pt.go
index bb7866a..2b4a759 100644
--- a/websocket-transport/pt.go
+++ b/websocket-transport/pt.go
@@ -37,6 +37,7 @@ import (
 	"net"
 	"os"
 	"strings"
+	"time"
 )
 
 func getenv(key string) string {
@@ -467,11 +468,13 @@ func PtConnectOr(info *PtServerInfo, conn net.Conn) (*net.TCPConn, error) {
 	if err != nil {
 		return nil, err
 	}
+	s.SetDeadline(time.Now().Add(5 * time.Second))
 	err = extOrPortAuthenticate(s, info)
 	if err != nil {
 		s.Close()
 		return nil, err
 	}
+	s.SetDeadline(time.Time{})
 
 	return s, nil
 }





More information about the tor-commits mailing list