Added asserts in case send queue size goes below zero.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
Jan Vidar Krey 2009-03-13 01:29:21 +01:00
parent 62d489130c
commit 5a978d361c

View File

@ -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;
} }
} }