Skip to content

Commit

Permalink
orchagent: Processing port state change notification whenever gPortsO…
Browse files Browse the repository at this point in the history
…rch is initialized or not (sonic-net#123)
  • Loading branch information
Shuotian Cheng authored Nov 4, 2016
1 parent 20116a1 commit 913d4ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions orchagent/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ void on_port_state_change(uint32_t count, sai_port_oper_status_notification_t *d

lock_guard<mutex> lock(gDbMutex);

/* Wait until gPortsOrch is initialized */
if (!gPortsOrch || !gPortsOrch->isInitDone())
if (!gPortsOrch)
{
SWSS_LOG_NOTICE("gPortsOrch is not initialized");
return;
}

for (uint32_t i = 0; i < count; i++)
{
sai_object_id_t id = data[i].port_id;
sai_port_oper_status_t status = data[i].port_state;

SWSS_LOG_NOTICE("Get port state change notification id:%llx status:%d", id, status);

gPortsOrch->updateDbPortOperStatus(id, status);
gPortsOrch->setHostIntfsOperStatus(id, status == SAI_PORT_OPER_STATUS_UP);
}
Expand Down

0 comments on commit 913d4ae

Please sign in to comment.