Handle any failure to get SRV records like there are none.
This commit is contained in:
parent
de9b58c4a6
commit
b9f214e320
2 changed files with 15 additions and 11 deletions
|
@ -230,7 +230,7 @@
|
|||
{
|
||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||
XMPPSRVEntry *candidate = nil;
|
||||
XMPPSRVLookup *SRVLookup;
|
||||
XMPPSRVLookup *SRVLookup = nil;
|
||||
OFEnumerator *enumerator;
|
||||
OFString *domainToASCII;
|
||||
char *cDomainToASCII;
|
||||
|
@ -255,16 +255,17 @@
|
|||
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]
|
||||
|
@ -277,7 +278,10 @@
|
|||
[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];
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
*
|
||||
* \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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue