// L2TPNS Clustering Stuff
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.26 2004/12/16 23:40:31 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.26.2.1 2005/01/06 01:39:23 bodea Exp $";
#include <stdio.h>
#include <stdlib.h>
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!
if (config->cluster_seq_number != h->seq) { // Out of sequence heartbeat!
- LOG(1, 0, 0, "HB: Got seq# %d but was expecting %d. asking for resend.\n", h->seq, config->cluster_seq_number);
+ static int lastseen_seq = 0;
+ static time_t lastseen_time = 0;
- peer_send_message(addr, C_LASTSEEN, config->cluster_seq_number, NULL, 0);
+ // limit to once per second for a particular seq#
+ int ask = (config->cluster_seq_number != lastseen_seq || time_now != lastseen_time);
+
+ LOG(1, 0, 0, "HB: Got seq# %d but was expecting %d. %s.\n",
+ h->seq, config->cluster_seq_number,
+ ask ? "Asking for resend" : "Ignoring");
+
+ if (ask)
+ {
+ lastseen_seq = config->cluster_seq_number;
+ lastseen_time = time_now;
+ peer_send_message(addr, C_LASTSEEN, config->cluster_seq_number, NULL, 0);
+ }
config->cluster_last_hb = TIME; // Reset to ensure that we don't become master!!