From: Pekka Riikonen Date: Thu, 9 Oct 2003 09:45:10 +0000 (+0000) Subject: Send RESUMED to backup router last. X-Git-Tag: silc.client.0.9.13~12 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=b47bc8e984faa66957ed48e2663b795c02599fba;p=silc.git Send RESUMED to backup router last. --- diff --git a/apps/silcd/server_backup.c b/apps/silcd/server_backup.c index 48cff69b..72becccc 100644 --- a/apps/silcd/server_backup.c +++ b/apps/silcd/server_backup.c @@ -944,7 +944,7 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup) SilcServerBackupProtocolContext ctx = protocol->context; SilcServer server = ctx->server; SilcServerEntry server_entry; - SilcSocketConnection sock; + SilcSocketConnection sock = NULL; unsigned char data[2]; int i; @@ -1133,7 +1133,9 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup) server->router, TRUE); /* We as primary router now must send RESUMED packets to all servers - and routers so that they know we are back. */ + and routers so that they know we are back. For backup router we + send the packet last so that we give the backup as much time as + possible to deal with message routing at this critical moment. */ for (i = 0; i < server->config->param.connections_max; i++) { sock = server->sockets[i]; if (!sock || !sock->user_data || @@ -1142,6 +1144,11 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup) sock->type != SILC_SOCKET_TYPE_SERVER)) continue; + /* Send to backup last */ + if (sock == ctx->sock) + continue; + + send_to_backup: server_entry = sock->user_data; server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED; @@ -1158,6 +1165,13 @@ SILC_TASK_CALLBACK_GLOBAL(silc_server_protocol_backup) silc_server_packet_queue_purge(server,sock); } + /* Now send the same packet to backup */ + if (sock != ctx->sock) { + sleep(1); + sock = ctx->sock; + goto send_to_backup; + } + /* We are now resumed and are back as primary router in the cell. */ SILC_LOG_INFO(("We are now the primary router of our cell again")); server->wait_backup = FALSE;