Skip to content

Commit

Permalink
[syncd] Fix notification on shutdown request (#635)
Browse files Browse the repository at this point in the history
* [syncd] Fix notification on shutdown request

* Move check to the beginning of the function
  • Loading branch information
kcudnik committed Jul 8, 2020
1 parent 9e57ba2 commit 1885a8c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,12 @@ void Syncd::sendShutdownRequest(
{
SWSS_LOG_ENTER();

if (m_notifications == nullptr)
{
SWSS_LOG_WARN("notifications pointer is NULL");
return;
}

auto s = sai_serialize_object_id(switchVid);

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

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

if (m_notifications == nullptr)
{
SWSS_LOG_WARN("notifications pointer is NULL");
return;
}
s = sai_serialize_switch_shutdown_request(switchVid);

m_notifications->send(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST, s, entry);
}
Expand Down

0 comments on commit 1885a8c

Please sign in to comment.