libgaim/protocols/qq/sendqueue.c

changeset 15378
bb7ca64f37d1
parent 15333
1220b92e8b11
equal deleted inserted replaced
15377:f45f57e922a7 15378:bb7ca64f37d1
31 31
32 #include "header_info.h" 32 #include "header_info.h"
33 #include "qq_proxy.h" 33 #include "qq_proxy.h"
34 #include "sendqueue.h" 34 #include "sendqueue.h"
35 35
36 #define QQ_RESEND_MAX 5 /* max resend per packet */ 36 #define QQ_RESEND_MAX 8 /* max resend per packet */
37 37
38 typedef struct _gc_and_packet gc_and_packet; 38 typedef struct _gc_and_packet gc_and_packet;
39 39
40 struct _gc_and_packet { 40 struct _gc_and_packet {
41 GaimConnection *gc; 41 GaimConnection *gc;
76 i++; 76 i++;
77 } 77 }
78 gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d packets in sendqueue are freed!\n", i); 78 gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d packets in sendqueue are freed!\n", i);
79 } 79 }
80 80
81 /* TODO drop get buddy list if we don't know about any buddies... 81 /* FIXME We shouldn't be dropping packets, but for now we have to because
82 * I think the server won't ACK a get buddies request if we have none */ 82 * somewhere we're generating invalid packets that the server won't ack.
83 * Given enough time, a buildup of those packets would crash the client. */
83 gboolean qq_sendqueue_timeout_callback(gpointer data) 84 gboolean qq_sendqueue_timeout_callback(gpointer data)
84 { 85 {
85 GaimConnection *gc; 86 GaimConnection *gc;
86 qq_data *qd; 87 qq_data *qd;
87 GList *list; 88 GList *list;
129 gaim_connection_error(gc, _("Login failed, no reply")); 130 gaim_connection_error(gc, _("Login failed, no reply"));
130 p->resend_times = -1; 131 p->resend_times = -1;
131 break; 132 break;
132 default:{ 133 default:{
133 gaim_debug(GAIM_DEBUG_WARNING, "QQ", 134 gaim_debug(GAIM_DEBUG_WARNING, "QQ",
134 "%s packet sent %d times but not acked. Resetting sendqueue life\n", 135 "%s packet sent %d times but not acked. Not resending it.\n",
135 qq_get_cmd_desc(p->cmd), QQ_RESEND_MAX); 136 qq_get_cmd_desc(p->cmd), QQ_RESEND_MAX);
136 } 137 }
137 p->resend_times = 0; 138 p->resend_times = -1;
138 } 139 }
139 } else { /* resend_times < QQ_RESEND_MAX, so sent it again */ 140 } else { /* resend_times < QQ_RESEND_MAX, so sent it again */
140 wait_time = (gint) (QQ_SENDQUEUE_TIMEOUT / 1000); 141 wait_time = (gint) (QQ_SENDQUEUE_TIMEOUT / 1000);
141 if (difftime(now, p->sendtime) > (wait_time * (p->resend_times + 1))) { 142 if (difftime(now, p->sendtime) > (wait_time * (p->resend_times + 1))) {
142 qq_proxy_write(qd, p->buf, p->len); 143 qq_proxy_write(qd, p->buf, p->len);

mercurial