Fixed another logic error, caused by a shadowed variable name.
authorChris Jones <christian.jones@sri.com>
Mon, 09 Sep 2013 02:13:07 +0100
changeset 135 a4755a42af19
parent 134 80b764fa2f08
child 136 f35f853a52b6
Fixed another logic error, caused by a shadowed variable name.
xmpp/xmpp.go
--- a/xmpp/xmpp.go	Sun Sep 08 14:40:35 2013 -0700
+++ b/xmpp/xmpp.go	Mon Sep 09 02:13:07 2013 +0100
@@ -119,17 +119,17 @@
 	var tcp *net.TCPConn
 	for _, srv := range srvs {
 		addrStr := fmt.Sprintf("%s:%d", srv.Target, srv.Port)
-		addr, err := net.ResolveTCPAddr("tcp", addrStr)
+		var addr *net.TCPAddr
+		addr, err = net.ResolveTCPAddr("tcp", addrStr)
 		if err != nil {
 			err = fmt.Errorf("ResolveTCPAddr(%s): %s",
 				addrStr, err.Error())
 			continue
 		}
 		tcp, err = net.DialTCP("tcp", nil, addr)
-		if err == nil {
+		if tcp != nil {
 			break
 		}
-		err = fmt.Errorf("DialTCP(%s): %s", addr, err)
 	}
 	if tcp == nil {
 		return nil, err