More debugs and errors.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 4 Apr 2005 16:14:22 +0000 (16:14 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 4 Apr 2005 16:14:22 +0000 (16:14 +0000)
apps/silcd/packet_send.c
apps/silcd/server_query.c
lib/silccore/silcpacket.c
lib/silcutil/unix/silcunixsockconn.c

index 0a7e52332a242cbe0c07f4b36397c821115b1b41..a7b13f0d099a64de8e61a853f513ae63049d1f7e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  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);
   }
 }
index db8634fcb930a65986c7d8d7bfc1a6b844f70843..da4a30f9c9043c393040563439b6f0810079b26c 100644 (file)
@@ -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);
index 58f090b9ab64a0c6652e8f2e44c3cba6bc2dd743..a9ce5639d33f2546a140e67fe25a573f1592e5c3 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  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;
index 821e4f86300b908779eac1db77300880cb4cc85f..a5d8c4d5bd67b2d484458a605be04382801fa914 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  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;