comparison libpurple/protocols/oscar/flap_connection.c @ 22717:979a81468e19

All SNACs on FLAP channel 2 except in the auth family are now sent through flap_connection_send_snac() instead of flap_connection_send(). This allows them to be tallied into the rate limiting calculations and to be throttled as necessary to prevent rate limiting violations. This does fix the instantaneous disconnection seen with the addition of ICQ Status Notes support for people with many ICQ contacts with status notes on their buddy list. Unfortunately, we still request the ICQ Status Note many times per contact, so such people now may be rate limited for a significant period of time as they connect.
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 24 Apr 2008 11:10:03 +0000
parents 3225c99785b8
children da3de0190be2
comparison
equal deleted inserted replaced
22715:80c87908ff1d 22717:979a81468e19
113 struct timeval now; 113 struct timeval now;
114 114
115 conn = data; 115 conn = data;
116 gettimeofday(&now, NULL); 116 gettimeofday(&now, NULL);
117 117
118 purple_debug_info("oscar", "Attempting to send %i queued SNACs for %p\n", g_queue_get_length(conn->queued_snacs), conn);
118 while (!g_queue_is_empty(conn->queued_snacs)) 119 while (!g_queue_is_empty(conn->queued_snacs))
119 { 120 {
120 QueuedSnac *queued_snac; 121 QueuedSnac *queued_snac;
121 struct rateclass *rateclass; 122 struct rateclass *rateclass;
122 123
187 new_current = rateclass_get_new_current(conn, rateclass, &now); 188 new_current = rateclass_get_new_current(conn, rateclass, &now);
188 189
189 /* (Add 100ms padding to account for inaccuracies in the calculation) */ 190 /* (Add 100ms padding to account for inaccuracies in the calculation) */
190 if (new_current < rateclass->alert + 100) 191 if (new_current < rateclass->alert + 100)
191 { 192 {
193 purple_debug_info("oscar", "Current rate for conn %p would be %u, but we alert at %u; enqueueing\n", conn, new_current, (rateclass->alert + 100));
194
192 enqueue = TRUE; 195 enqueue = TRUE;
193 } 196 }
194 else 197 else
195 { 198 {
196 rateclass->current = new_current; 199 rateclass->current = new_current;
197 rateclass->last.tv_sec = now.tv_sec; 200 rateclass->last.tv_sec = now.tv_sec;
198 rateclass->last.tv_usec = now.tv_usec; 201 rateclass->last.tv_usec = now.tv_usec;
199 } 202 }
203 } else {
204 purple_debug_warning("oscar", "No rate class found for family %u subtype %u\n", family, subtype);
200 } 205 }
201 206
202 if (enqueue) 207 if (enqueue)
203 { 208 {
204 /* We've been sending too fast, so delay this message */ 209 /* We've been sending too fast, so delay this message */