From a3d75c5ce57f025459bbaa4ed3df045c3664dcd9 Mon Sep 17 00:00:00 2001 From: Ethan Stewart Date: Fri, 8 Sep 2017 13:05:59 -0400 Subject: listen for announces on init and linkup --- daemons/gptp/common/common_port.cpp | 5 +++-- daemons/gptp/common/ether_port.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/daemons/gptp/common/common_port.cpp b/daemons/gptp/common/common_port.cpp index cf1c51af..ae13cf18 100644 --- a/daemons/gptp/common/common_port.cpp +++ b/daemons/gptp/common/common_port.cpp @@ -550,7 +550,7 @@ bool CommonPort::processEvent( Event e ) // If port has been configured as master or slave, run media // specific configuration. If it hasn't been configured - // start announce message time + // start listening for announce messages if( clock->getPriority1() == 255 || port_state == PTP_SLAVE ) { @@ -562,7 +562,8 @@ bool CommonPort::processEvent( Event e ) } else { - startAnnounce(); + clock->addEventTimerLocked(this, ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES, + ANNOUNCE_RECEIPT_TIMEOUT_MULTIPLIER * pow(2.0, getAnnounceInterval()) * 1000000000.0); } // Do any media specific initialization diff --git a/daemons/gptp/common/ether_port.cpp b/daemons/gptp/common/ether_port.cpp index 024531cc..2325fb99 100644 --- a/daemons/gptp/common/ether_port.cpp +++ b/daemons/gptp/common/ether_port.cpp @@ -408,7 +408,8 @@ bool EtherPort::_processEvent( Event e ) } else if( getPortState() == PTP_MASTER ) { becomeMaster( true ); } else { - startAnnounce(); + clock->addEventTimerLocked(this, ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES, + ANNOUNCE_RECEIPT_TIMEOUT_MULTIPLIER * pow(2.0, getAnnounceInterval()) * 1000000000.0); } if (automotive_profile) { -- cgit v1.2.1