Commit 4870a0fe authored by Alessandro Rubini's avatar Alessandro Rubini

check announce interval when set, not when used

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 89185bf9
......@@ -166,7 +166,12 @@ int pp_parse_cmdline(struct pp_instance *ppi, int argc, char **argv)
break;
case 'n':
a = argv[++i];
/* Page 237 says 0 to 4 (1s .. 16s) */
OPTS(ppi)->announce_intvl = atoi(a);
if (OPTS(ppi)->announce_intvl < 0)
OPTS(ppi)->announce_intvl = 0;
if (OPTS(ppi)->announce_intvl > 4)
OPTS(ppi)->announce_intvl = 4;
break;
case 'm':
a = argv[++i];
......
......@@ -47,18 +47,15 @@ int st_com_execute_slave(struct pp_instance *ppi, int check_delayreq)
return ret;
}
/* Called by listening, passive, slave, and this same file */
void st_com_restart_annrec_timer(struct pp_instance *ppi)
{
/* 0 <= logAnnounceInterval <= 4, see pag. 237 of spec */
if (DSPOR(ppi)->logAnnounceInterval < 0)
PP_PRINTF("Error: logAnnounceInterval < 0");
pp_timeout_set(ppi, PP_TO_ANN_RECEIPT,
((DSPOR(ppi)->announceReceiptTimeout) <<
DSPOR(ppi)->logAnnounceInterval) * 1000);
}
/* Called by listening, master, passive, slave */
int st_com_check_record_update(struct pp_instance *ppi)
{
if (ppi->record_update) {
......
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