[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit f56178868ca38a5c75b697bb98855882197b2260
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits