Skip to content

Commit 1885a8c

Browse files
authored
[syncd] Fix notification on shutdown request (sonic-net#635)
* [syncd] Fix notification on shutdown request * Move check to the beginning of the function
1 parent 9e57ba2 commit 1885a8c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

syncd/Syncd.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -3156,6 +3156,12 @@ void Syncd::sendShutdownRequest(
31563156
{
31573157
SWSS_LOG_ENTER();
31583158

3159+
if (m_notifications == nullptr)
3160+
{
3161+
SWSS_LOG_WARN("notifications pointer is NULL");
3162+
return;
3163+
}
3164+
31593165
auto s = sai_serialize_object_id(switchVid);
31603166

31613167
SWSS_LOG_NOTICE("sending switch_shutdown_request notification to OA for switch: %s", s.c_str());
@@ -3164,11 +3170,7 @@ void Syncd::sendShutdownRequest(
31643170

31653171
// TODO use m_handler->onSwitchShutdownRequest(switchVid); (but this should be per switch)
31663172

3167-
if (m_notifications == nullptr)
3168-
{
3169-
SWSS_LOG_WARN("notifications pointer is NULL");
3170-
return;
3171-
}
3173+
s = sai_serialize_switch_shutdown_request(switchVid);
31723174

31733175
m_notifications->send(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST, s, entry);
31743176
}

0 commit comments

Comments
 (0)