X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/4d7d7850b5d242bf9b77ac07e7c06ef523c627e6..c3e841988ea3dfc005a414de54d252d2fe0b071c:/cluster.c diff --git a/cluster.c b/cluster.c index 808ab84..093d944 100644 --- a/cluster.c +++ b/cluster.c @@ -1,6 +1,6 @@ // 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 #include @@ -1177,9 +1177,22 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t 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!!