From 0ec4913e1545ac047b32a11a2005d2f00773aa42 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Sat, 25 Jul 2009 03:23:27 +0200 Subject: [PATCH] Debug for send queue fix. --- src/netevent.c | 10 +++++----- src/user.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/netevent.c b/src/netevent.c index 241b473..1ad715e 100644 --- a/src/netevent.c +++ b/src/netevent.c @@ -36,16 +36,16 @@ void debug_sendq_send(struct user* user, int sent, int total) void debug_sendq_recv(struct user* user, int received, int max, const char* buffer) { - printf("RECV: %d/%d bytes\n", ret, (int) len); - if (ret == -1) + printf("RECV: %d/%d bytes\n", received, (int) max); + if (received == -1) { int err = net_error(); printf(" errno: %d - %s\n", err, net_error_string(err)); } - else if (ret > 0) + else if (received > 0) { - char* data = hub_malloc_zero(ret + 1); - memcpy(data, buf, ret); + char* data = hub_malloc_zero(received + 1); + memcpy(data, buffer, received); printf("RECV: \"%s\"\n", data); hub_free(data); } diff --git a/src/user.c b/src/user.c index 8dec2cb..1605950 100644 --- a/src/user.c +++ b/src/user.c @@ -331,7 +331,7 @@ int user_is_registered(struct user* user) void user_net_io_want_write(struct user* user) { #ifdef DEBUG_SENDQ - hub_log(log_trace, "user_net_io_want_write: %s", user_log_str(user)); + hub_log(log_trace, "user_net_io_want_write: %s (pending: %d)", user_log_str(user), event_pending(&user->net.event, EV_READ | EV_WRITE, 0)); #endif if (user->net.events == (EV_READ | EV_WRITE)) return; @@ -344,7 +344,7 @@ void user_net_io_want_write(struct user* user) void user_net_io_want_read(struct user* user) { #ifdef DEBUG_SENDQ - hub_log(log_trace, "user_net_io_want_read: %s", user_log_str(user)); + hub_log(log_trace, "user_net_io_want_read: %s (pending: %d)", user_log_str(user), event_pending(&user->net.event, EV_READ | EV_WRITE, 0)); #endif if (user->net.events == EV_READ) return;