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

[PATCH v2]: teamsyncd #3

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions common/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ void Select::addSelectable(Selectable *c)
m_objects.push_back(c);
}

void Select::removeSelectable(Selectable *c)
{
for (auto i = m_objects.begin(); i != m_objects.end(); i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use std::find_first_of

if (*i == c)
{
m_objects.erase(i);
return;
}
}

void Select::addFd(int fd)
{
m_fds.push_back(fd);
Expand Down
3 changes: 2 additions & 1 deletion common/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ namespace swss {
class Select
{
public:
/* Add object for select */
/* Add object for select can be called during Selectable::readMe */
void addSelectable(Selectable *c);
void removeSelectable(Selectable *c);

/* Add file-descriptor for select */
void addFd(int fd);
Expand Down