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

[tor-commits] [snowflake/master] Don't log "SOCKS accepted" if there was an Accept error.



commit 6a9c2bf95123373d55798bcabcb439ef7c24f205
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Wed Mar 21 00:43:17 2018 -0700

    Don't log "SOCKS accepted" if there was an Accept error.
    
    This actually caused a nil pointer dereference panic when Accept
    returned an error, because conn was nil.
---
 client/snowflake.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/snowflake.go b/client/snowflake.go
index 3b8a248..105fd30 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -57,13 +57,13 @@ func socksAcceptLoop(ln *pt.SocksListener, snowflakes SnowflakeCollector) error
 	for {
 		log.Println("SOCKS listening...")
 		conn, err := ln.AcceptSocks()
-		log.Println("SOCKS accepted: ", conn.Req)
 		if err != nil {
 			if e, ok := err.(net.Error); ok && e.Temporary() {
 				continue
 			}
 			return err
 		}
+		log.Println("SOCKS accepted: ", conn.Req)
 		err = handler(conn, snowflakes)
 		if err != nil {
 			log.Printf("handler error: %s", err)



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