From 5a978d361ccfaa945fc5ec8bef0043919b883563 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Fri, 13 Mar 2009 01:29:21 +0100 Subject: [PATCH] Added asserts in case send queue size goes below zero. Signed-off-by: Jan Vidar Krey --- src/netevent.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/netevent.c b/src/netevent.c index 65d950b..d13d377 100644 --- a/src/netevent.c +++ b/src/netevent.c @@ -176,6 +176,10 @@ void net_on_write(int fd, short ev, void *arg) { user->send_queue_size -= ret; user->send_queue_offset = 0; + + assert(user->send_queue_size >= 0); + assert(user->send_queue_offset >= 0); + list_remove(user->send_queue, msg); 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_offset -= ret; + + assert(user->send_queue_size >= 0); + assert(user->send_queue_offset >= 0); break; } }