Skip to content

Commit

Permalink
Change to force a rebuild of the pollset on flag changes (#1393)
Browse files Browse the repository at this point in the history
* Change to force a rebuild of the pollset on flag changes

This change fixes issues seen in #1357, resulting from #1281
  • Loading branch information
guillaumeautran authored and dirk-thomas committed Aug 9, 2018
1 parent 7d9e407 commit 0463bc9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions clients/roscpp/src/libros/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ void close_socket_watcher(int fd) {
void add_socket_to_watcher(int epfd, int fd) {
#if defined(HAVE_EPOLL)
struct epoll_event ev;
bzero(&ev, sizeof(ev));

ev.events = 0;
ev.data.fd = fd;

Expand Down Expand Up @@ -147,6 +149,8 @@ void del_socket_from_watcher(int epfd, int fd) {
void set_events_on_socket(int epfd, int fd, int events) {
#if defined(HAVE_EPOLL)
struct epoll_event ev;
bzero(&ev, sizeof(ev));

ev.events = events;
ev.data.fd = fd;
if (::epoll_ctl(epfd, EPOLL_CTL_MOD, fd, &ev))
Expand Down
2 changes: 2 additions & 0 deletions clients/roscpp/src/libros/poll_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ bool PollSet::addEvents(int sock, int events)

set_events_on_socket(epfd_, sock, it->second.events_);

sockets_changed_ = true;
signal();

return true;
Expand All @@ -161,6 +162,7 @@ bool PollSet::delEvents(int sock, int events)

set_events_on_socket(epfd_, sock, it->second.events_);

sockets_changed_ = true;
signal();

return true;
Expand Down
2 changes: 1 addition & 1 deletion test/test_roscpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
catkin_add_gtest(${PROJECT_NAME}-test_version test_version.cpp)
if(TARGET ${PROJECT_NAME}-test_version)
target_link_libraries(${PROJECT_NAME}-test_version)
target_link_libraries(${PROJECT_NAME}-test_version ${catkin_LIBRARIES})
endif()

catkin_add_gtest(${PROJECT_NAME}-test_header test_header.cpp)
Expand Down
8 changes: 4 additions & 4 deletions test/test_roscpp/test_serialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ endif()

catkin_add_gtest(${PROJECT_NAME}-serialization src/serialization.cpp)
if(TARGET ${PROJECT_NAME}-serialization)
target_link_libraries(${PROJECT_NAME}-serialization ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
target_link_libraries(${PROJECT_NAME}-serialization ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME}-serialization ${${PROJECT_NAME}_EXPORTED_TARGETS})
endif()

catkin_add_gtest(${PROJECT_NAME}-generated_messages src/generated_messages.cpp)
if(TARGET ${PROJECT_NAME}-generated_messages)
target_link_libraries(${PROJECT_NAME}-generated_messages ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
target_link_libraries(${PROJECT_NAME}-generated_messages ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME}-generated_messages ${${PROJECT_NAME}_EXPORTED_TARGETS})
endif()

add_executable(${PROJECT_NAME}-builtin_types EXCLUDE_FROM_ALL src/builtin_types.cpp)
add_dependencies(tests ${PROJECT_NAME}-builtin_types)
target_link_libraries(${PROJECT_NAME}-builtin_types ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
target_link_libraries(${PROJECT_NAME}-builtin_types ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME}-builtin_types ${${PROJECT_NAME}_EXPORTED_TARGETS})
add_rostest(test/builtin_types.test)

add_executable(${PROJECT_NAME}-pre_deserialize EXCLUDE_FROM_ALL src/pre_deserialize.cpp)
add_dependencies(tests ${PROJECT_NAME}-pre_deserialize)
target_link_libraries(${PROJECT_NAME}-pre_deserialize ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
target_link_libraries(${PROJECT_NAME}-pre_deserialize ${GTEST_LIBRARIES} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME}-pre_deserialize ${${PROJECT_NAME}_EXPORTED_TARGETS})
add_rostest(test/pre_deserialize.test)

0 comments on commit 0463bc9

Please sign in to comment.