ObjXMPP  Check-in [c7b3eed29f]

Overview
Comment:Fix accumulatedWeight and iterate priorities in the right order.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c7b3eed29ff70020183bec55806dc86f2e9c1a95c68c573cd5c45210886dd11a
User & Date: js on 2011-05-26 16:38:37
Other Links: manifest | tags
Context
2011-05-26
16:52
Shorten -[XMPPSRVEnumerator XMPP_addEntry:]. check-in: 4a6ca02f0d user: js tags: trunk
16:38
Fix accumulatedWeight and iterate priorities in the right order. check-in: c7b3eed29f user: js tags: trunk
2011-05-25
22:41
Get rid of an unnecessary loop. check-in: e240aaaf2a user: js tags: trunk
Changes

Modified src/XMPPSRVEnumerator.h from [cfa5111ccc] to [853838c173].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57


58
59
60
61
62
63
64
#include <resolv.h>

#import <ObjFW/ObjFW.h>

@interface XMPPSRVEntry: OFObject
{
	uint16_t priority;
	uint16_t weight, accumulatedWeight;

	uint16_t port;
	OFString *target;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) uint16_t priority;
@property (readonly, assign) uint16_t weight;
@property (assign) uint16_t accumulatedWeight;
@property (readonly, assign) uint16_t port;
@property (readonly, copy) OFString *target;
#endif

+ entryWithPriority: (uint16_t)priority
	     weight: (uint16_t)weight
	       port: (uint16_t)port
	     target: (OFString*)target;
+ entryWithResourceRecord: (ns_rr)resourceRecord
		   handle: (ns_msg)handle;
- initWithPriority: (uint16_t)priority
	    weight: (uint16_t)weight
	      port: (uint16_t)port
	    target: (OFString*)target;
- initWithResourceRecord: (ns_rr)resourceRecord
		  handle: (ns_msg)handle;
- (uint16_t)priority;
- (uint16_t)weight;


- (uint16_t)port;
- (OFString*)target;
@end

@interface XMPPSRVEnumerator: OFEnumerator
{
	OFString *domain;







|
>







|


















>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <resolv.h>

#import <ObjFW/ObjFW.h>

@interface XMPPSRVEntry: OFObject
{
	uint16_t priority;
	uint16_t weight;
	uint32_t accumulatedWeight;
	uint16_t port;
	OFString *target;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) uint16_t priority;
@property (readonly, assign) uint16_t weight;
@property (assign) uint32_t accumulatedWeight;
@property (readonly, assign) uint16_t port;
@property (readonly, copy) OFString *target;
#endif

+ entryWithPriority: (uint16_t)priority
	     weight: (uint16_t)weight
	       port: (uint16_t)port
	     target: (OFString*)target;
+ entryWithResourceRecord: (ns_rr)resourceRecord
		   handle: (ns_msg)handle;
- initWithPriority: (uint16_t)priority
	    weight: (uint16_t)weight
	      port: (uint16_t)port
	    target: (OFString*)target;
- initWithResourceRecord: (ns_rr)resourceRecord
		  handle: (ns_msg)handle;
- (uint16_t)priority;
- (uint16_t)weight;
- (uint32_t)accumulatedWeight;
- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight;
- (uint16_t)port;
- (OFString*)target;
@end

@interface XMPPSRVEnumerator: OFEnumerator
{
	OFString *domain;

Modified src/XMPPSRVEnumerator.m from [f3a2775abf] to [f3533e40c3].

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
}

- (uint16_t)weight
{
	return weight;
}

- (void)setAccumulatedWeight: (uint16_t)accumulatedWeight_
{
	accumulatedWeight = accumulatedWeight_;
}

- (uint16_t)accumulatedWeight
{
	return accumulatedWeight;
}

- (uint16_t)port
{
	return port;







|




|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
}

- (uint16_t)weight
{
	return weight;
}

- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight_
{
	accumulatedWeight = accumulatedWeight_;
}

- (uint32_t)accumulatedWeight
{
	return accumulatedWeight;
}

- (uint16_t)port
{
	return port;
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	of_list_object_t *iter;
	uint32_t totalWeight = 0;

	if (done)
		return nil;

	if (listIter == NULL)
		listIter = [list lastListObject];

	if (listIter == NULL)
		return nil;

	if (subListCopy == nil)
		subListCopy = [listIter->object copy];








|







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	of_list_object_t *iter;
	uint32_t totalWeight = 0;

	if (done)
		return nil;

	if (listIter == NULL)
		listIter = [list firstListObject];

	if (listIter == NULL)
		return nil;

	if (subListCopy == nil)
		subListCopy = [listIter->object copy];

358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
		}
	}

	if ([subListCopy count] == 0) {
		[subListCopy release];
		subListCopy = nil;

		listIter = listIter->previous;

		if (listIter == NULL)
			done = YES;
	}

	return ret;
}







|







358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
		}
	}

	if ([subListCopy count] == 0) {
		[subListCopy release];
		subListCopy = nil;

		listIter = listIter->next;

		if (listIter == NULL)
			done = YES;
	}

	return ret;
}