Debug for send queue fix.

This commit is contained in:
Jan Vidar Krey 2009-07-25 03:23:27 +02:00
parent 61d639bfa2
commit 0ec4913e15
2 changed files with 7 additions and 7 deletions

View File

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

View File

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