[tor-commits] [obfs4/master] fix incorrect connection close

yawning at torproject.org yawning at torproject.org
Mon Jan 25 12:17:41 UTC 2016


commit c0e8866c13f051c4eea0c1d940b8592cd7c8075c
Author: pminmax945 <pminmax945 at gmail.com>
Date:   Sun Jan 17 12:23:20 2016 +0000

    fix incorrect connection close
    
    when obfs4 connection create failed,conn variable is
    set to nil already.
---
 transports/obfs4/obfs4.go |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/transports/obfs4/obfs4.go b/transports/obfs4/obfs4.go
index 5701535..40b1406 100644
--- a/transports/obfs4/obfs4.go
+++ b/transports/obfs4/obfs4.go
@@ -214,8 +214,9 @@ func (cf *obfs4ClientFactory) Dial(network, addr string, dialFn base.DialFunc, a
 	if err != nil {
 		return nil, err
 	}
+	dialConn := conn
 	if conn, err = newObfs4ClientConn(conn, ca); err != nil {
-		conn.Close()
+		dialConn.Close()
 		return nil, err
 	}
 	return conn, nil





More information about the tor-commits mailing list