251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
@try {
domainToASCII = [OFString
stringWithCString: cDomainToASCII];
} @finally {
free(cDomainToASCII);
}
@try {
SRVLookup = [XMPPSRVLookup
lookupWithDomain: domainToASCII];
enumerator = [SRVLookup objectEnumerator];
while ((candidate = [enumerator nextObject]) != nil) {
@try {
[sock connectToHost: [candidate target]
port: [candidate port]];
break;
} @catch (OFAddressTranslationFailedException
*e) {
[e release];
} @catch (OFConnectionFailedException *e) {
[e release];
}
}
} @catch (OFAddressTranslationFailedException *e) {
[e release];
}
if (!candidate)
[sock connectToHost: domainToASCII
port: port];
}
[self XMPP_startStream];
[pool release];
}
|
<
|
|
|
>
|
>
>
>
>
>
|
<
<
<
<
<
<
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
@try {
domainToASCII = [OFString
stringWithCString: cDomainToASCII];
} @finally {
free(cDomainToASCII);
}
SRVLookup = [XMPPSRVLookup
lookupWithDomain: domainToASCII];
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 {
do {
@try {
[sock connectToHost: [candidate target]
port: [candidate port]];
break;
} @catch (OFAddressTranslationFailedException
*e) {
[e release];
} @catch (OFConnectionFailedException *e) {
[e release];
}
} while ((candidate = [enumerator nextObject]) != nil);
}
}
[self XMPP_startStream];
[pool release];
}
|