Fix a bug causing us to open a TCP connection to every server and use the last one.
authorChris Jones <christian.jones@sri.com>
Sat, 31 Aug 2013 23:08:21 +0100
changeset 120 9d7e8333948b
parent 119 712aa5780660
child 121 ebb86cbdd218
Fix a bug causing us to open a TCP connection to every server and use the last one.
xmpp.go
--- a/xmpp.go	Sat Aug 31 23:06:55 2013 +0100
+++ b/xmpp.go	Sat Aug 31 23:08:21 2013 +0100
@@ -113,11 +113,10 @@
 			continue
 		}
 		tcp, err = net.DialTCP("tcp", nil, addr)
-		if err != nil {
-			err = fmt.Errorf("DialTCP(%s): %s",
-				addr, err)
-			continue
+		if err == nil {
+			break
 		}
+		err = fmt.Errorf("DialTCP(%s): %s", addr, err)
 	}
 	if tcp == nil {
 		return nil, err