Browse Source

Merge branch 'master' of https://github.com/rod-hynes/psiphon-tunnel-core into packet-tunnel

Rod Hynes 8 years ago
parent
commit
f34a8f216c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      psiphon/TCPConn_bind.go

+ 3 - 1
psiphon/TCPConn_bind.go

@@ -165,11 +165,13 @@ func tcpDial(addr string, config *DialConfig) (net.Conn, error) {
 
 		err = goselect.Select(socketFd+1, nil, fdset, nil, timeout)
 		if err != nil {
+			syscall.Close(socketFd)
 			lastErr = common.ContextError(err)
 			continue
 		}
 		if !fdset.IsSet(uintptr(socketFd)) {
-			lastErr = common.ContextError(errors.New("file descriptor not set"))
+			syscall.Close(socketFd)
+			lastErr = common.ContextError(errors.New("connect timed out"))
 			continue
 		}