This is an automated email from the ASF dual-hosted git repository.

rbulter pushed a commit to branch feature/add_kqueue_to_udpmc
in repository https://gitbox.apache.org/repos/asf/celix.git

commit dbfac5dcf80d99737f6d18afb8035c0e96584d40
Author: Roy Bulter <[email protected]>
AuthorDate: Sat Apr 18 08:45:56 2020 +0200

    Fix build errors
---
 bundles/pubsub/CMakeLists.txt                                  |  9 +--------
 .../pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c      | 10 +++++++---
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/bundles/pubsub/CMakeLists.txt b/bundles/pubsub/CMakeLists.txt
index 8f87f3f..f4ac92a 100644
--- a/bundles/pubsub/CMakeLists.txt
+++ b/bundles/pubsub/CMakeLists.txt
@@ -29,16 +29,9 @@ if (PUBSUB)
         add_subdirectory(pubsub_admin_tcp)
     endif (BUILD_PUBSUB_PSA_TCP)
 
-    set(BUILD_PUBSUB_PSA_UDP_MC_DEFAULT ON)
-    if (APPLE)
-        set(BUILD_PUBSUB_PSA_UDP_MC_DEFAULT OFF)
-    endif ()
-    option(BUILD_PUBSUB_PSA_UDP_MC "Build UDP MC PubSub Admin" 
${BUILD_PUBSUB_PSA_UDP_MC_DEFAULT})
+    option(BUILD_PUBSUB_PSA_UDP_MC "Build UDP MC PubSub Admin" ON)
     if (BUILD_PUBSUB_PSA_UDP_MC)
         add_subdirectory(pubsub_admin_udp_mc)
-        if (APPLE)
-            message(WARNING "UDP MC PubSub Admin not supported on OSX, expect 
compiler errors due to epoll!")
-        endif ()
     endif (BUILD_PUBSUB_PSA_UDP_MC)
 
     set(BUILD_PUBSUB_PSA_WS_DEFAULT ON)
diff --git 
a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c 
b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c
index bb437d6..fde3c13 100644
--- a/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c
+++ b/bundles/pubsub/pubsub_admin_udp_mc/src/pubsub_udpmc_topic_receiver.c
@@ -132,7 +132,6 @@ pubsub_udpmc_topic_receiver_t* 
pubsub_udpmcTopicReceiver_create(celix_bundle_con
     receiver->ifIpAddress = strndup(ifIP, 1024 * 1024);
     receiver->recvThread.running = true;
     receiver->largeUdpHandle = largeUdp_create(MAX_UDP_SESSIONS);
-    receiver->topicEpollFd = epoll_create1(0);
 #if defined(__APPLE__)
     receiver->topicEpollFd = kqueue();
 #else
@@ -307,7 +306,7 @@ void 
pubsub_udpmcTopicReceiver_disconnectFrom(pubsub_udpmc_topic_receiver_t *rec
 #if defined(__APPLE__)
         struct kevent ev;
         EV_SET (&ev, entry->recvSocket, EVFILT_READ, EV_DELETE, 0, 0, 0);
-        rc = kevent (receiver->topicEpollFd, &ev, 1, NULL, 0, NULL);
+        int rc = kevent (receiver->topicEpollFd, &ev, 1, NULL, 0, NULL);
 #else
         struct epoll_event ev;
         memset(&ev, 0, sizeof(ev));
@@ -422,7 +421,12 @@ static void* psa_udpmc_recvThread(void * data) {
         for (i = 0; i < nfds; i++ ) {
             unsigned int index;
             unsigned int size;
-            if (largeUdp_dataAvailable(receiver->largeUdpHandle, 
events[i].data.fd, &index, &size) == true) {
+#if defined(__APPLE__)
+            int fd = events[i].ident;
+#else
+            int fd = events[i].data.fd;
+#endif
+            if (largeUdp_dataAvailable(receiver->largeUdpHandle, fd, &index, 
&size) == true) {
                 // Handle data
                 pubsub_udp_msg_t *udpMsg = NULL;
                 if (largeUdp_read(receiver->largeUdpHandle, index, (void**) 
&udpMsg, size) != 0) {

Reply via email to