You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by er...@apache.org on 2018/10/16 12:31:54 UTC

celix git commit: Removed sleep in zmqadmin read-thread and fixed doublke destroy of property

Repository: celix
Updated Branches:
  refs/heads/develop 3b56bcebc -> 24def6839


Removed sleep in zmqadmin read-thread and fixed doublke destroy of property


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/24def683
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/24def683
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/24def683

Branch: refs/heads/develop
Commit: 24def683920dfd4145178130a7f96fa923a13676
Parents: 3b56bce
Author: Erjan Altena <er...@gmail.com>
Authored: Tue Oct 16 14:23:02 2018 +0200
Committer: Erjan Altena <er...@gmail.com>
Committed: Tue Oct 16 14:30:40 2018 +0200

----------------------------------------------------------------------
 .../pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c     | 11 +++++++++--
 bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c       |  5 ++---
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/24def683/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c
----------------------------------------------------------------------
diff --git a/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c b/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c
index 7a07827..1633058 100644
--- a/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c
+++ b/bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_receiver.c
@@ -165,7 +165,14 @@ pubsub_zmq_topic_receiver_t* pubsub_zmqTopicReceiver_create(celix_bundle_context
     }
 
     if (receiver->zmqSocket != NULL) {
+        int timeout = PSA_ZMQ_RECV_TIMEOUT;
+        void *zmqSocket =  zsock_resolve(receiver->zmqSocket);
+        int res = zmq_setsockopt(zmqSocket, ZMQ_RCVTIMEO, &timeout, sizeof(timeout));
+        if (res) {
+            L_ERROR("[PSA_ZMQ] Cannot set ZMQ socket option ZMQ_RCVTIMEO errno=%d", errno);
+        }
 #ifdef BUILD_WITH_ZMQ_SECURITY
+
         zcert_apply (sub_cert, zmq_s);
         zsock_set_curve_serverkey (zmq_s, pub_key); //apply key of publisher to socket of subscriber
 #endif
@@ -397,10 +404,10 @@ static void* psa_zmq_recvThread(void * data) {
     celixThreadMutex_unlock(&receiver->recvThread.mutex);
 
     while (running) {
-        zframe_t* headerMsg = zframe_recv_nowait(receiver->zmqSocket);
+        zframe_t* headerMsg = zframe_recv(receiver->zmqSocket);
         if (headerMsg == NULL) {
             if(errno == EAGAIN) {
-                usleep(PSA_ZMQ_RECV_TIMEOUT);
+                // Do nothing
             } else if (errno == EINTR) {
                 //It means we got a signal and we have to exit...
                 L_INFO("PSA_ZMQ_TS: header_recv thread for topic got a signal and will exit.\n");

http://git-wip-us.apache.org/repos/asf/celix/blob/24def683/bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c
----------------------------------------------------------------------
diff --git a/bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c b/bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c
index bbe4fe7..1542e4f 100644
--- a/bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c
+++ b/bundles/pubsub/pubsub_spi/src/pubsub_utils_match.c
@@ -176,6 +176,7 @@ double pubsub_utils_matchSubscriber(
 		requested_qos = celix_properties_get(ep, PUBSUB_UTILS_QOS_ATTRIBUTE_KEY, NULL);
 		requested_serializer = celix_properties_get(ep, PUBSUB_ENDPOINT_SERIALIZER, NULL);
 		celix_properties_destroy(ep);
+		data.outEndpoint = NULL;
 	}
 
 	double score = getPSAScore(requested_admin, requested_qos, adminType, sampleScore, controlScore, defaultScore);
@@ -185,8 +186,6 @@ double pubsub_utils_matchSubscriber(
 		score = PUBSUB_ADMIN_NO_MATCH_SCORE; //no serializer, no match
 	}
 
-//	printf("Score subscriber service match for psa type %s is %f\n", adminType, score);
-
 	if (outSerializerSvcId != NULL) {
 		*outSerializerSvcId = serializerSvcId;
 	}
@@ -222,4 +221,4 @@ bool pubsub_utils_matchEndpoint(
 	}
 
 	return match;
-}
\ No newline at end of file
+}