ObjXMPP  Check-in [a762e88af4]

Overview
Comment:Don't connect to any address record if SRV records exist
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a762e88af4c7c2e2d489c79d75ce7e14fec067c2fd83fcdb4dcd4e2a392f50c3
User & Date: florob@babelmonkeys.de on 2011-06-16 18:28:52
Other Links: manifest | tags
Context
2011-06-16
19:00
Handle any failure to get SRV records like there are none. check-in: f0f53f4aa7 user: js tags: trunk
18:28
Don't connect to any address record if SRV records exist check-in: a762e88af4 user: florob@babelmonkeys.de tags: trunk
18:26
Catch the case where the domain exists, but SRV records don't check-in: dad0ddb2c0 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPConnection.m from [dc3dcbf9b8] to [1b284eeb7a].

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];
}