ObjXMPP  Check-in [f0f53f4aa7]

Overview
Comment:Handle any failure to get SRV records like there are none.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f0f53f4aa713b8608760c0b114ef5075d827d321d7b97379b271613969cee6e1
User & Date: js on 2011-06-16 19:00:28
Other Links: manifest | tags
Context
2011-08-04
16:59
Adjust to recent ObjFW changes. check-in: 8242aaa109 user: js tags: trunk
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
Changes

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

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	return [[password copy] autorelease];
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	XMPPSRVEntry *candidate = nil;
	XMPPSRVLookup *SRVLookup;
	OFEnumerator *enumerator;
	OFString *domainToASCII;
	char *cDomainToASCII;
	Idna_rc rc;

	if (server)
		[sock connectToHost: server







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
	return [[password copy] autorelease];
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	XMPPSRVEntry *candidate = nil;
	XMPPSRVLookup *SRVLookup = nil;
	OFEnumerator *enumerator;
	OFString *domainToASCII;
	char *cDomainToASCII;
	Idna_rc rc;

	if (server)
		[sock connectToHost: server
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];
}








>
|
|
>
>
>
>


|
|
<
<
<
<












|
>
>
>







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
289
290
291
		@try {
			domainToASCII = [OFString
			    stringWithCString: cDomainToASCII];
		} @finally {
			free(cDomainToASCII);
		}

		@try {
			SRVLookup = [XMPPSRVLookup
			    lookupWithDomain: domainToASCII];
		} @catch (id e) {
			[e release];
		}

		enumerator = [SRVLookup objectEnumerator];

		/* Iterate over SRV records, if any */
		if ((candidate = [enumerator nextObject]) != nil) {




			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);
		} else
			/* No SRV records -> fall back to A / AAAA record */
			[sock connectToHost: domainToASCII
				       port: port];
	}

	[self XMPP_startStream];

	[pool release];
}

Modified src/XMPPIQ.h from [f689491164] to [7810d97c14].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	  ID: (OFString*)ID;

/**
 * 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
 */
- initWithType: (OFString*)type
	    ID: (OFString*)ID;

/**
 * Generates a result IQ for the receiving object
 *







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	  ID: (OFString*)ID;

/**
 * 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 An initialized XMPPIQ
 */
- initWithType: (OFString*)type
	    ID: (OFString*)ID;

/**
 * Generates a result IQ for the receiving object
 *