Skip to content

Commit

Permalink
Topic subscription scalability fix (#1281)
Browse files Browse the repository at this point in the history
Address a long standing issue where the `sockets_changed_` flag would never be reset causing the native poll set to be re-created everytime doing a poll.
  • Loading branch information
guillaumeautran authored and dirk-thomas committed Feb 9, 2018
1 parent b08ade0 commit 49baa4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clients/roscpp/src/libros/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ pollfd_vector_ptr poll_sockets(int epfd, socket_pollfd *fds, nfds_t nfds, int ti
#else
UNUSED(epfd);
pollfd_vector_ptr ofds(new std::vector<socket_pollfd>);
// Clear the `revents` fields
for (nfds_t i = 0; i < nfds; i++)
{
fds[i].revents = 0;
}

// use an existing poll implementation
int result = poll(fds, nfds, timeout);
if ( result < 0 )
Expand Down
1 change: 1 addition & 0 deletions clients/roscpp/src/libros/poll_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ void PollSet::createNativePollset()
pfd.events = info.events_;
pfd.revents = 0;
}
sockets_changed_ = false;
}

void PollSet::onLocalPipeEvents(int events)
Expand Down

0 comments on commit 49baa4b

Please sign in to comment.