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];
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||||
XMPPSRVEntry *candidate = nil;
|
XMPPSRVEntry *candidate = nil;
|
||||||
XMPPSRVLookup *SRVLookup;
|
XMPPSRVLookup *SRVLookup = nil;
|
||||||
OFEnumerator *enumerator;
|
OFEnumerator *enumerator;
|
||||||
OFString *domainToASCII;
|
OFString *domainToASCII;
|
||||||
char *cDomainToASCII;
|
char *cDomainToASCII;
|
||||||
|
@ -255,16 +255,17 @@
|
||||||
free(cDomainToASCII);
|
free(cDomainToASCII);
|
||||||
}
|
}
|
||||||
|
|
||||||
SRVLookup = [XMPPSRVLookup
|
@try {
|
||||||
lookupWithDomain: domainToASCII];
|
SRVLookup = [XMPPSRVLookup
|
||||||
|
lookupWithDomain: domainToASCII];
|
||||||
|
} @catch (id e) {
|
||||||
|
[e release];
|
||||||
|
}
|
||||||
|
|
||||||
enumerator = [SRVLookup objectEnumerator];
|
enumerator = [SRVLookup objectEnumerator];
|
||||||
|
|
||||||
// If there are no SRV records connect via A/AAAA record
|
/* Iterate over SRV records, if any */
|
||||||
if ((candidate = [enumerator nextObject]) == nil)
|
if ((candidate = [enumerator nextObject]) != nil) {
|
||||||
[sock connectToHost: domainToASCII
|
|
||||||
port: port];
|
|
||||||
// Iterate over SRV records
|
|
||||||
else {
|
|
||||||
do {
|
do {
|
||||||
@try {
|
@try {
|
||||||
[sock connectToHost: [candidate target]
|
[sock connectToHost: [candidate target]
|
||||||
|
@ -277,7 +278,10 @@
|
||||||
[e release];
|
[e release];
|
||||||
}
|
}
|
||||||
} while ((candidate = [enumerator nextObject]) != nil);
|
} while ((candidate = [enumerator nextObject]) != nil);
|
||||||
}
|
} else
|
||||||
|
/* No SRV records -> fall back to A / AAAA record */
|
||||||
|
[sock connectToHost: domainToASCII
|
||||||
|
port: port];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self XMPP_startStream];
|
[self XMPP_startStream];
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
*
|
*
|
||||||
* \param type The value for the stanza's type attribute
|
* \param type The value for the stanza's type attribute
|
||||||
* \param ID The value for the stanza's id attribute
|
* \param ID The value for the stanza's id attribute
|
||||||
* \return A initialized XMPPIQ
|
* \return An initialized XMPPIQ
|
||||||
*/
|
*/
|
||||||
- initWithType: (OFString*)type
|
- initWithType: (OFString*)type
|
||||||
ID: (OFString*)ID;
|
ID: (OFString*)ID;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue