From 138a56853fc7c20dd8a870e99a0d82de3f30b1e6 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 8 Dec 2004 15:16:09 +0000 Subject: [PATCH] Do not try to initiate backup resuming forever. --- CHANGES | 5 +++++ apps/silcd/server_backup.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index e4f5cc12..e89ef865 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Wed Dec 8 16:15:11 CET 2004 Pekka Riikonen + + * 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 * ID change in resuming has to be done before changing diff --git a/apps/silcd/server_backup.c b/apps/silcd/server_backup.c index 612add49..ddc3ab14 100644 --- a/apps/silcd/server_backup.c +++ b/apps/silcd/server_backup.c @@ -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, -- 2.43.0