Do not try to initiate backup resuming forever.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 8 Dec 2004 15:16:09 +0000 (15:16 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 8 Dec 2004 15:16:09 +0000 (15:16 +0000)
CHANGES
apps/silcd/server_backup.c

diff --git a/CHANGES b/CHANGES
index e4f5cc12568e4422b5a7b73a7a9cb6a538ec9617..e89ef86584cba7da424bf230f5f2ee26660d0bd2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+Wed Dec  8 16:15:11 CET 2004  Pekka Riikonen <priikone@silcnet.org>
+
+       * Do not try to initiate backup resuming protocol forever.
+         Affected file silcd/server_backup.c.
+
 Wed Nov 24 18:24:05 CET 2004  Pekka Riikonen <priikone@silcnet.org>
 
        * ID change in resuming has to be done before changing
index 612add49b02b1c71bb973defb26d3785e1581432..ddc3ab14ddffbea3ab864df56c87386ceba7755a 100644 (file)
@@ -69,6 +69,7 @@ typedef struct {
   SilcUInt8 session;
   SilcServerBackupProtocolSession *sessions;
   SilcUInt32 sessions_count;
+  SilcUInt32 initiator_restart;
   long start;
   unsigned int responder        : 1;
   unsigned int received_failure : 1;
@@ -1459,6 +1460,10 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
            ctx->sock = NULL;
          }
 
+         /* If failed after 10 attempts, it won't work, give up */
+         if (ctx->initiator_restart > 10)
+           ctx->received_failure = TRUE;
+
          if (!ctx->received_failure) {
            /* Protocol error, probably timeout. Just restart the protocol. */
            SilcServerBackupProtocolContext proto_ctx;
@@ -1470,6 +1475,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
            proto_ctx->responder = FALSE;
            proto_ctx->type = SILC_SERVER_BACKUP_START;
            proto_ctx->start = time(0);
+           proto_ctx->initiator_restart = ctx->initiator_restart + 1;
 
            /* Start through scheduler */
            silc_schedule_task_add(server->schedule, 0,