From 78c3f3f627ddbe1b26332f8bb22653b9431d6ec0 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 4 Apr 2005 16:14:22 +0000 Subject: [PATCH] More debugs and errors. --- apps/silcd/packet_send.c | 11 +++++++++-- apps/silcd/server_query.c | 9 +++++++-- lib/silccore/silcpacket.c | 10 +++++++--- lib/silcutil/unix/silcunixsockconn.c | 4 ++-- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apps/silcd/packet_send.c b/apps/silcd/packet_send.c index 0a7e5233..a7b13f0d 100644 --- a/apps/silcd/packet_send.c +++ b/apps/silcd/packet_send.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2004 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,6 +42,10 @@ int silc_server_packet_send_real(SilcServer server, ret = silc_packet_send(sock, FALSE); if (ret != -2) { if (ret == -1) { + SILC_SET_CONNECTION_FOR_INPUT(server->schedule, sock->sock); + SILC_UNSET_OUTBUF_PENDING(sock); + silc_buffer_clear(sock->outbuf); + SILC_LOG_ERROR(("Error sending packet to connection " "%s:%d [%s]", sock->hostname, sock->port, (sock->type == SILC_SOCKET_TYPE_UNKNOWN ? "Unknown" : @@ -2065,15 +2069,18 @@ void silc_server_packet_queue_purge(SilcServer server, if (sock->outbuf && sock->outbuf->len > 0) { /* Couldn't send all data, put the queue back up, we'll send rest later. */ + SILC_LOG_DEBUG(("Could not purge immediately, sending rest later")); SILC_SET_CONNECTION_FOR_OUTPUT(server->schedule, sock->sock); SILC_SET_OUTBUF_PENDING(sock); return; } + } else if (ret == -1) { + SILC_LOG_ERROR(("Error purging packet queue, packets dropped")); } /* Purged all data */ - SILC_UNSET_OUTBUF_PENDING(sock); SILC_SET_CONNECTION_FOR_INPUT(server->schedule, sock->sock); + SILC_UNSET_OUTBUF_PENDING(sock); silc_buffer_clear(sock->outbuf); } } diff --git a/apps/silcd/server_query.c b/apps/silcd/server_query.c index db8634fc..da4a30f9 100644 --- a/apps/silcd/server_query.c +++ b/apps/silcd/server_query.c @@ -43,7 +43,7 @@ typedef struct { void *id; /* ID */ SilcIdType id_type; /* ID type */ unsigned int index : 15; /* Index to IDs */ - unsigned int type : 2; /* 0 = take from query->ids, 0 = take + unsigned int type : 2; /* 0 = take from query->ids, 1 = take from args, 2 = no args in error. */ unsigned int error : 7; /* The actual error (SilcStatus) */ } *SilcServerQueryError; @@ -1753,8 +1753,13 @@ void silc_server_query_send_reply(SilcServer server, } } - if (!sent_reply) + if (!sent_reply) { SILC_LOG_ERROR(("BUG: Query did not send anything")); + SILC_LOG_ERROR(("BUG: Sending %d clients", clients_count)); + SILC_LOG_ERROR(("BUG: Sending %d servers", servers_count)); + SILC_LOG_ERROR(("BUG: Sending %d channels", channels_count)); + SILC_LOG_ERROR(("BUG: Sending %d errors", query->errors_count)); + } /* Cleanup */ silc_server_query_free(query); diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index 58f090b9..a9ce5639 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2003 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,8 +56,12 @@ int silc_packet_send(SilcSocketConnection sock, bool force_send) ret = silc_socket_write(sock); if (ret == -1) { - SILC_LOG_ERROR(("Error sending packet, dropped: %s", - strerror(errno))); + SILC_LOG_ERROR(("Error sending packet to %s:%d [%s], dropped: %s", + sock->hostname ? sock->hostname : "", sock->port, + (sock->type == SILC_SOCKET_TYPE_UNKNOWN ? "Unknown" : + sock->type == SILC_SOCKET_TYPE_CLIENT ? "Client" : + sock->type == SILC_SOCKET_TYPE_SERVER ? "Server" : + "Router"), strerror(errno))); } if (ret != -2) return ret; diff --git a/lib/silcutil/unix/silcunixsockconn.c b/lib/silcutil/unix/silcunixsockconn.c index 821e4f86..a5d8c4d5 100644 --- a/lib/silcutil/unix/silcunixsockconn.c +++ b/lib/silcutil/unix/silcunixsockconn.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2003 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ int silc_socket_write(SilcSocketConnection sock) SilcBuffer src = sock->outbuf; if (!src) - return -2; + return -1; if (SILC_IS_DISABLED(sock)) return -1; -- 2.43.0