More log prints
authorPekka Riikonen <priikone@silcnet.org>
Fri, 3 Jan 2003 21:02:35 +0000 (21:02 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 3 Jan 2003 21:02:35 +0000 (21:02 +0000)
apps/silcd/server.c
apps/silcd/server_backup.c

index 539b9d30ab7698e0d43abcc73206440e4c4f91ae..c3359196fe887f7dfc30da1aeed9c6a8b751f15c 100644 (file)
@@ -3161,6 +3161,7 @@ void silc_server_free_sock_user_data(SilcServer server,
          server->id_entry->router = NULL;
          server->router = NULL;
          server->standalone = TRUE;
+         server->backup_primary = FALSE;
          backup_router = NULL;
        } else {
          if (server->id_entry != backup_router) {
@@ -5061,7 +5062,8 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_rekey_final)
   if (protocol->state == SILC_PROTOCOL_STATE_ERROR ||
       protocol->state == SILC_PROTOCOL_STATE_FAILURE) {
     /* Error occured during protocol */
-    SILC_LOG_ERROR(("Error occurred during rekey protocol"));
+    SILC_LOG_ERROR(("Error occurred during rekey protocol with
+                  %s (%s)", sock->hostname, sock->ip));
     silc_protocol_cancel(protocol, server->schedule);
     silc_protocol_free(protocol);
     sock->protocol = NULL;
index 548875f057d64781562673384faa561ee156f4e4..78634fe2e02fcc35a8b58da88df56808590256ce 100644 (file)
@@ -712,6 +712,8 @@ static void silc_server_backup_connect_primary(SilcServer server,
   idata = (SilcIDListData)server_entry;
 
   SILC_LOG_DEBUG(("Sending CONNECTED packet (session %d)", ctx->session));
+  SILC_LOG_INFO(("Sending CONNECTED (session %d) to backup router",
+               ctx->session));
 
   /* Send the CONNECTED packet back to the backup router. */
   buffer = silc_buffer_alloc(2);
@@ -914,7 +916,14 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup)
         to be back online. We send the CONNECTED packet after we've
         established the connection to the primary router. */
       primary = silc_server_config_get_primary_router(server);
-      if (primary && server->backup_primary) {
+      if (primary && server->backup_primary &&
+         !silc_server_num_sockets_by_remote(server,
+                                            silc_net_is_ip(primary->host) ?
+                                            primary->host : NULL,
+                                            silc_net_is_ip(primary->host) ?
+                                            NULL : primary->host,
+                                            primary->port,
+                                            SILC_SOCKET_TYPE_ROUTER)) {
        SILC_LOG_DEBUG(("Received START (session %d), reconnect to router",
                        ctx->session));
        silc_server_backup_reconnect(server,
@@ -925,6 +934,8 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup)
        /* Nowhere to connect just return the CONNECTED packet */
        SILC_LOG_DEBUG(("Received START (session %d), send CONNECTED back",
                        ctx->session));
+       SILC_LOG_INFO(("Sending CONNECTED (session %d) to backup router",
+                     ctx->session));
 
        /* Send the CONNECTED packet back to the backup router. */
        packet = silc_buffer_alloc(2);
@@ -1149,6 +1160,7 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup)
          SILC_LOG_INFO(("Resuming the use of primary router %s",
                         router->server_name));
        }
+       server->backup_primary = FALSE;
 
        /* Update the client entries of the backup router to the new 
           router */