Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -228,11 +228,11 @@ - (void)connect { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; XMPPSRVEntry *candidate = nil; - XMPPSRVLookup *SRVLookup; + XMPPSRVLookup *SRVLookup = nil; OFEnumerator *enumerator; OFString *domainToASCII; char *cDomainToASCII; Idna_rc rc; @@ -253,20 +253,21 @@ stringWithCString: cDomainToASCII]; } @finally { free(cDomainToASCII); } - SRVLookup = [XMPPSRVLookup - lookupWithDomain: domainToASCII]; + @try { + SRVLookup = [XMPPSRVLookup + lookupWithDomain: domainToASCII]; + } @catch (id e) { + [e release]; + } + enumerator = [SRVLookup objectEnumerator]; - // If there are no SRV records connect via A/AAAA record - if ((candidate = [enumerator nextObject]) == nil) - [sock connectToHost: domainToASCII - port: port]; - // Iterate over SRV records - else { + /* Iterate over SRV records, if any */ + if ((candidate = [enumerator nextObject]) != nil) { do { @try { [sock connectToHost: [candidate target] port: [candidate port]]; break; @@ -275,11 +276,14 @@ [e release]; } @catch (OFConnectionFailedException *e) { [e release]; } } while ((candidate = [enumerator nextObject]) != nil); - } + } else + /* No SRV records -> fall back to A / AAAA record */ + [sock connectToHost: domainToASCII + port: port]; } [self XMPP_startStream]; [pool release]; Index: src/XMPPIQ.h ================================================================== --- src/XMPPIQ.h +++ src/XMPPIQ.h @@ -40,11 +40,11 @@ /** * Initializes an already allocated XMPPIQ with the specified type and id * * \param type The value for the stanza's type attribute * \param ID The value for the stanza's id attribute - * \return A initialized XMPPIQ + * \return An initialized XMPPIQ */ - initWithType: (OFString*)type ID: (OFString*)ID; /**