Address a bug that can happen if no SRV records can be found.
authorChris Jones <christian.jones@sri.com>
Sat, 07 Sep 2013 19:49:57 -0700
changeset 131 f9ccfaf672ed
parent 130 da6f37ae3ffe
child 132 feaa24de9597
Address a bug that can happen if no SRV records can be found.
xmpp/xmpp.go
--- a/xmpp/xmpp.go	Sat Sep 07 14:43:54 2013 -0700
+++ b/xmpp/xmpp.go	Sat Sep 07 19:49:57 2013 -0700
@@ -110,8 +110,10 @@
 	// Resolve the domain in the JID.
 	_, srvs, err := net.LookupSRV(clientSrv, "tcp", jid.Domain)
 	if err != nil {
-		return nil, errors.New("LookupSrv " + jid.Domain +
-			": " + err.Error())
+		return nil, fmt.Errorf("LookupSrv %s: %v", jid.Domain, err)
+	}
+	if len(srvs) == 0 {
+		return nil, fmt.Errorf("LookupSrv %s: no results", jid.Domain)
 	}
 
 	var tcp *net.TCPConn