Added asserts in case send queue size goes below zero.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
parent
62d489130c
commit
5a978d361c
@ -176,6 +176,10 @@ void net_on_write(int fd, short ev, void *arg)
|
|||||||
{
|
{
|
||||||
user->send_queue_size -= ret;
|
user->send_queue_size -= ret;
|
||||||
user->send_queue_offset = 0;
|
user->send_queue_offset = 0;
|
||||||
|
|
||||||
|
assert(user->send_queue_size >= 0);
|
||||||
|
assert(user->send_queue_offset >= 0);
|
||||||
|
|
||||||
list_remove(user->send_queue, msg);
|
list_remove(user->send_queue, msg);
|
||||||
|
|
||||||
if (user_flag_get(user, flag_user_list) && (msg == user->info || user->send_queue_size == 0))
|
if (user_flag_get(user, flag_user_list) && (msg == user->info || user->send_queue_size == 0))
|
||||||
@ -193,6 +197,9 @@ void net_on_write(int fd, short ev, void *arg)
|
|||||||
{
|
{
|
||||||
user->send_queue_size -= ret;
|
user->send_queue_size -= ret;
|
||||||
user->send_queue_offset -= ret;
|
user->send_queue_offset -= ret;
|
||||||
|
|
||||||
|
assert(user->send_queue_size >= 0);
|
||||||
|
assert(user->send_queue_offset >= 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user