Mercurial > pidgin
comparison libpurple/protocols/oscar/flap_connection.c @ 28937:89bece95a522
We were using this formula from before the documentation was public, and
for some reason I think it's a good idea for this comment to not indicate
that we got the formula from the documentation
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 02 Feb 2010 23:44:33 +0000 |
parents | 4575d8daba12 |
children | 2e3e0801de29 |
comparison
equal
deleted
inserted
replaced
28936:6b0c4667c4fb | 28937:89bece95a522 |
---|---|
131 rateclass_get_new_current(FlapConnection *conn, struct rateclass *rateclass, struct timeval *now) | 131 rateclass_get_new_current(FlapConnection *conn, struct rateclass *rateclass, struct timeval *now) |
132 { | 132 { |
133 unsigned long timediff; /* In milliseconds */ | 133 unsigned long timediff; /* In milliseconds */ |
134 guint32 current; | 134 guint32 current; |
135 | 135 |
136 /* This formula is documented at http://dev.aol.com/aim/oscar/#RATELIMIT */ | |
136 timediff = (now->tv_sec - rateclass->last.tv_sec) * 1000 + (now->tv_usec - rateclass->last.tv_usec) / 1000; | 137 timediff = (now->tv_sec - rateclass->last.tv_sec) * 1000 + (now->tv_usec - rateclass->last.tv_usec) / 1000; |
137 current = ((rateclass->current * (rateclass->windowsize - 1)) + timediff) / rateclass->windowsize; | 138 current = ((rateclass->current * (rateclass->windowsize - 1)) + timediff) / rateclass->windowsize; |
138 | 139 |
139 /* This formula is taken from http://dev.aol.com/aim/oscar/#RATELIMIT */ | |
140 return MIN(current, rateclass->max); | 140 return MIN(current, rateclass->max); |
141 } | 141 } |
142 | 142 |
143 /* | 143 /* |
144 * Attempt to send the contents of a given queue | 144 * Attempt to send the contents of a given queue |