mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:33:02 +01:00
ensure messages in queue are always delivered in order
This commit is contained in:
parent
5a175f374a
commit
5aad8764b1
@ -134,13 +134,14 @@ void cqueue_try_send(ToxWindow *self, Tox *m)
|
||||
{
|
||||
struct chat_queue *q = self->chatwin->cqueue;
|
||||
struct cqueue_msg *msg = q->root;
|
||||
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
uint64_t curtime = get_unix_time();
|
||||
|
||||
while (msg) {
|
||||
if (msg->receipt != 0 && !timed_out(msg->last_send_try, curtime, CQUEUE_TRY_SEND_INTERVAL)) {
|
||||
msg = msg->next;
|
||||
continue;
|
||||
}
|
||||
if (msg->receipt != 0 && !timed_out(msg->last_send_try, curtime, CQUEUE_TRY_SEND_INTERVAL))
|
||||
return;
|
||||
|
||||
uint32_t receipt = 0;
|
||||
|
||||
@ -153,4 +154,3 @@ void cqueue_try_send(ToxWindow *self, Tox *m)
|
||||
msg->receipt = receipt;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ void *thread_cqueue(void *data)
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
usleep(7000);
|
||||
usleep(4000);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user