Fix accumulatedWeight and iterate priorities in the right order.

This commit is contained in:
Jonathan Schleifer 2011-05-26 18:38:37 +02:00
parent 9fd6e76322
commit 53a2499381
2 changed files with 9 additions and 6 deletions

View file

@ -28,7 +28,8 @@
@interface XMPPSRVEntry: OFObject
{
uint16_t priority;
uint16_t weight, accumulatedWeight;
uint16_t weight;
uint32_t accumulatedWeight;
uint16_t port;
OFString *target;
}
@ -36,7 +37,7 @@
#ifdef OF_HAVE_PROPERTIES
@property (readonly, assign) uint16_t priority;
@property (readonly, assign) uint16_t weight;
@property (assign) uint16_t accumulatedWeight;
@property (assign) uint32_t accumulatedWeight;
@property (readonly, assign) uint16_t port;
@property (readonly, copy) OFString *target;
#endif
@ -55,6 +56,8 @@
handle: (ns_msg)handle;
- (uint16_t)priority;
- (uint16_t)weight;
- (uint32_t)accumulatedWeight;
- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight;
- (uint16_t)port;
- (OFString*)target;
@end

View file

@ -132,12 +132,12 @@
return weight;
}
- (void)setAccumulatedWeight: (uint16_t)accumulatedWeight_
- (void)setAccumulatedWeight: (uint32_t)accumulatedWeight_
{
accumulatedWeight = accumulatedWeight_;
}
- (uint16_t)accumulatedWeight
- (uint32_t)accumulatedWeight
{
return accumulatedWeight;
}
@ -326,7 +326,7 @@
return nil;
if (listIter == NULL)
listIter = [list lastListObject];
listIter = [list firstListObject];
if (listIter == NULL)
return nil;
@ -362,7 +362,7 @@
[subListCopy release];
subListCopy = nil;
listIter = listIter->previous;
listIter = listIter->next;
if (listIter == NULL)
done = YES;