Commit 79ffd673 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk Committed by Alessandro Rubini

state-master: don't send f-up if sync stamp is wrong

This is bsased on Greg's original commit, which is in wrs-4.1.2-fixes,
that we developed and released in the wr-switch-sw maintainance for the
4.1 series.

What we do here is return error for sending if the timestamp is not
correctly retrieved; the error is already handled in the sync+f.up
pair, so this is enough for f.up to not be sent.

The commit also changes state-master, in that we need to restart the
timeout for sync (and annunce) even if one even of sync (announce,
resp) fails.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent e360d3b0
......@@ -49,6 +49,8 @@ static inline int __send_and_log(struct pp_instance *ppi, int msglen,
(int)(ppi->last_snt_time.seconds),
(int)(ppi->last_snt_time.nanoseconds),
pp_msg_names[msgtype]);
if (ppi->last_snt_time.correct == 0)
return -1;
return 0;
}
......
......@@ -25,20 +25,22 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
}
if (pp_timeout_z(ppi, PP_TO_SYNC)) {
/* Restart the timeout for next time */
pp_timeout_rand(ppi, PP_TO_SYNC, DSPOR(ppi)->logSyncInterval);
if ((e = msg_issue_sync_followup(ppi) < 0))
goto out;
/* Restart the timeout for next time */
pp_timeout_rand(ppi, PP_TO_SYNC, DSPOR(ppi)->logSyncInterval);
}
if (pp_timeout_z(ppi, PP_TO_ANN_INTERVAL)) {
if ((e = msg_issue_announce(ppi) < 0))
goto out;
/* Restart the timeout for next time */
pp_timeout_rand(ppi, PP_TO_ANN_INTERVAL,
DSPOR(ppi)->logAnnounceInterval);
if ((e = msg_issue_announce(ppi) < 0))
goto out;
}
if (plen == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment