Commit ee45a0a6 authored by Aurelio Colosimo's avatar Aurelio Colosimo

portState field correctly handled in DSPort Dataset

parent c6de634d
......@@ -8,6 +8,7 @@
int pp_disabled(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
/* nothing to do */
DSPOR(ppi)->portState = PPS_DISABLED;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
return 0;
}
......@@ -13,6 +13,7 @@
int pp_faulty(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
DSPOR(ppi)->portState = PPS_FAULTY;
pp_printf("event FAULT_CLEARED\n");
ppi->next_state = PPS_INITIALIZING;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS * 4;
......
......@@ -23,6 +23,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (pp_net_init(ppi) < 0)
goto failure;
pp_did_init = 1;
DSPOR(ppi)->portState = PPS_INITIALIZING;
/* Initialize default data set */
DSDEF(ppi)->twoStepFlag = PP_TWO_STEP_FLAG;
......
......@@ -11,8 +11,10 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
int e = 0; /* error var, to check errors in msg handling */
if (ppi->is_new_state)
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_LISTENING;
st_com_restart_annrec_timer(ppi);
}
if (st_com_check_record_update(ppi))
goto state_updated;
......
......@@ -21,6 +21,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
time = &ppi->last_rcv_time;
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_MASTER;
pp_timer_start(1 << DSPOR(ppi)->logSyncInterval,
ppi->timers[PP_TIMER_SYNC]);
......
......@@ -11,6 +11,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
int e = 0; /* error var, to check errors in msg handling */
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_PASSIVE;
pp_timer_start(1 << DSPOR(ppi)->logMinPdelayReqInterval,
ppi->timers[PP_TIMER_PDELAYREQ]);
......
......@@ -11,5 +11,6 @@ int pp_pre_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
* No need of PRE_MASTER state because of only ordinary clock
* implementation.
*/
DSPOR(ppi)->portState = PPS_PRE_MASTER;
return 0;
}
......@@ -19,6 +19,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
time = &ppi->last_rcv_time;
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_SLAVE;
pp_init_clock(ppi);
ppi->waiting_for_follow = FALSE;
......
......@@ -8,6 +8,7 @@
int pp_disabled(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
/* nothing to do */
DSPOR(ppi)->portState = PPS_DISABLED;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS;
return 0;
}
......@@ -13,6 +13,7 @@
int pp_faulty(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
DSPOR(ppi)->portState = PPS_FAULTY;
pp_printf("event FAULT_CLEARED\n");
ppi->next_state = PPS_INITIALIZING;
ppi->next_delay = PP_DEFAULT_NEXT_DELAY_MS * 4;
......
......@@ -22,6 +22,7 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (pp_net_init(ppi) < 0)
goto failure;
pp_did_init = 1;
DSPOR(ppi)->portState = PPS_INITIALIZING;
/* Initialize default data set */
DSDEF(ppi)->twoStepFlag = PP_TWO_STEP_FLAG;
......
......@@ -11,8 +11,10 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
int e = 0; /* error var, to check errors in msg handling */
if (ppi->is_new_state)
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_LISTENING;
st_com_restart_annrec_timer(ppi);
}
if (st_com_check_record_update(ppi))
goto state_updated;
......
......@@ -21,6 +21,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
time = &ppi->last_rcv_time;
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_MASTER;
pp_timer_start(1 << DSPOR(ppi)->logSyncInterval,
ppi->timers[PP_TIMER_SYNC]);
......
......@@ -11,6 +11,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
int e = 0; /* error var, to check errors in msg handling */
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_PASSIVE;
pp_timer_start(1 << DSPOR(ppi)->logMinPdelayReqInterval,
ppi->timers[PP_TIMER_PDELAYREQ]);
......
......@@ -11,5 +11,6 @@ int pp_pre_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
* No need of PRE_MASTER state because of only ordinary clock
* implementation.
*/
DSPOR(ppi)->portState = PPS_PRE_MASTER;
return 0;
}
......@@ -19,6 +19,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
time = &ppi->last_rcv_time;
if (ppi->is_new_state) {
DSPOR(ppi)->portState = PPS_SLAVE;
pp_init_clock(ppi);
ppi->waiting_for_follow = FALSE;
......
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