From 7f27b626ad389b86b57d688632134491ceacf1a5 Mon Sep 17 00:00:00 2001 From: Lai Peter Jun Ann Date: Thu, 24 Oct 2024 13:10:55 +0800 Subject: [PATCH] clkmgr: Fix Incorrect gm_changed event status. Signed-off-by: Lai Peter Jun Ann --- clkmgr/client/notification_msg.cpp | 3 +-- clkmgr/client/subscribe_msg.cpp | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clkmgr/client/notification_msg.cpp b/clkmgr/client/notification_msg.cpp index 11c64b15..2d92ee16 100644 --- a/clkmgr/client/notification_msg.cpp +++ b/clkmgr/client/notification_msg.cpp @@ -168,8 +168,7 @@ PROCESS_MESSAGE_TYPE(ClientNotificationMessage::processMessage) client_ptp_data->gm_changed_event_count.fetch_add(1, std::memory_order_relaxed); clkmgrCurrentState.gm_changed = true; - } else - clkmgrCurrentState.gm_changed = false; + } if((eventSub & eventASCapable) && (proxy_data.as_capable != client_ptp_data->as_capable)) { client_ptp_data->as_capable = proxy_data.as_capable; diff --git a/clkmgr/client/subscribe_msg.cpp b/clkmgr/client/subscribe_msg.cpp index caec889c..f4ef6196 100644 --- a/clkmgr/client/subscribe_msg.cpp +++ b/clkmgr/client/subscribe_msg.cpp @@ -246,4 +246,7 @@ void ClientSubscribeMessage::resetClientPtpEventStruct(sessionId_t sID, client_ptp_data->synced_to_gm_event_count; eventCount.gm_changed_event_count = client_ptp_data->gm_changed_event_count; eventCount.composite_event_count = client_ptp_data->composite_event_count; + /* Reset gm_changed event if the event count is 0 */ + if(client_ptp_data->gm_changed_event_count == 0) + clkmgrCurrentState->gm_changed = false; }