Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portsyncd] fix portsyncd restart case #1019

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,27 @@ LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) :
if (!WarmStart::isWarmStart())
{
/* See the comments for g_portSet in portsyncd.cpp */
for (string port : g_portSet)
for (auto port_iter = g_portSet.begin(); port_iter != g_portSet.end();)
{
string port = *port_iter;
vector<FieldValueTuple> temp;
bool portFound = false;
if (m_portTable.get(port, temp))
{
for (auto it : temp)
{
if (fvField(it) == "admin_status")
{
g_portSet.erase(port);
port_iter = g_portSet.erase(port_iter);
portFound = true;
break;
}
}
}
if (!portFound)
{
++port_iter;
}
}

for (idx_p = if_ni;
Expand Down
8 changes: 4 additions & 4 deletions portsyncd/portsyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ int main(int argc, char **argv)
WarmStart::checkWarmStart("portsyncd", "swss");
const bool warm = WarmStart::isWarmStart();

LinkSync sync(&appl_db, &state_db);
NetDispatcher::getInstance().registerMessageHandler(RTM_NEWLINK, &sync);
NetDispatcher::getInstance().registerMessageHandler(RTM_DELLINK, &sync);

try
{
NetLink netlink;
Expand All @@ -102,6 +98,10 @@ int main(int argc, char **argv)
}
}

LinkSync sync(&appl_db, &state_db);
NetDispatcher::getInstance().registerMessageHandler(RTM_NEWLINK, &sync);
NetDispatcher::getInstance().registerMessageHandler(RTM_DELLINK, &sync);

s.addSelectable(&netlink);
s.addSelectable(&portCfg);

Expand Down