phc2sys: fix handling of multiple state changes.

When the master clock changed its state and then changed it back to the
original state before phc2sys could process the first change, e.g. SLAVE
-> UNCALIBRATED -> SLAVE after a clockcheck failure, the second change
was ignored because the new value was the same as the original state,
which wasn't updated for the first change yet. This caused phc2sys to be
stuck with a wrong state.

Fix phc2sys to check both the state and new_state variables of the clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2017-09-01 13:41:41 +02:00 committed by Richard Cochran
parent 14a97dc5da
commit 17c9787b1d
1 changed files with 1 additions and 1 deletions

View File

@ -786,7 +786,7 @@ static int recv_subscribed(struct node *node, struct ptp_message *msg,
port->state = state; port->state = state;
clock = port->clock; clock = port->clock;
state = clock_compute_state(node, clock); state = clock_compute_state(node, clock);
if (clock->state != state) { if (clock->state != state || clock->new_state) {
clock->new_state = state; clock->new_state = state;
node->state_changed = 1; node->state_changed = 1;
} }