Commit 415e530e authored by Alessandro Rubini's avatar Alessandro Rubini

timeout: move restart_annrec() to ppsi.h

The function st_com_restart_annrec_timer is now just a one-liner, and
it really is just a timeout operation.

So call it pp_timeout_restart_annrec instead, and have it inline in
ppsi.h, removing it from common-fun.c
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 4870a0fe
......@@ -341,10 +341,14 @@ static inline int pp_timeout_z(struct pp_instance *ppi, int index)
return ret;
}
/* This functions are generic, not architecture-specific */
extern void pp_timeout_set(struct pp_instance *ppi, int index, int millisec);
extern void pp_timeout_clr(struct pp_instance *ppi, int index);
extern int pp_timeout(struct pp_instance *ppi, int index); /* 1 == timeout */
/* called several times, only sets a timeout, so inline it here */
static inline void pp_timeout_restart_annrec(struct pp_instance *ppi)
{
/* This timeout is a number of the announce interval lapses */
pp_timeout_set(ppi, PP_TO_ANN_RECEIPT,
((DSPOR(ppi)->announceReceiptTimeout) <<
DSPOR(ppi)->logAnnounceInterval) * 1000);
}
/* The channel for an instance must be created and possibly destroyed. */
......
......@@ -27,7 +27,7 @@ int st_com_execute_slave(struct pp_instance *ppi, int check_delayreq)
ppi->next_state = PPS_MASTER;
} else {
ppi->next_state = PPS_LISTENING;
st_com_restart_annrec_timer(ppi);
pp_timeout_restart_annrec(ppi);
}
}
......@@ -47,14 +47,6 @@ 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)
{
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)
{
......@@ -158,7 +150,7 @@ int st_com_slave_handle_announce(struct pp_instance *ppi, unsigned char *buf,
}
/*Reset Timer handling Announce receipt timeout*/
st_com_restart_annrec_timer(ppi);
pp_timeout_restart_annrec(ppi);
if (pp_hooks.handle_announce)
pp_hooks.handle_announce(ppi);
......
......@@ -18,7 +18,7 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_LISTENING;
st_com_restart_annrec_timer(ppi);
pp_timeout_restart_annrec(ppi);
}
if (st_com_check_record_update(ppi))
......
......@@ -13,7 +13,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_PASSIVE;
st_com_restart_annrec_timer(ppi);
pp_timeout_restart_annrec(ppi);
}
if (st_com_check_record_update(ppi))
......
......@@ -28,7 +28,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->waiting_for_follow = FALSE;
st_com_restart_annrec_timer(ppi);
pp_timeout_restart_annrec(ppi);
pp_timeout_rand(ppi, PP_TO_DELAYREQ,
DSPOR(ppi)->logMinDelayReqInterval);
......
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