abroekhuis commented on a change in pull request #172: Refactor TcpAdmin and
add interfacing for VectorIoSerialisation
URL: https://github.com/apache/celix/pull/172#discussion_r401412687
##########
File path: bundles/pubsub/pubsub_admin_zmq/src/pubsub_zmq_topic_sender.c
##########
@@ -562,33 +566,38 @@ static int psa_zmq_topicPublicationSend(void* handle,
unsigned int msgTypeId, co
bool sendOk;
if (bound->parent->zeroCopyEnabled) {
+ int flags = 0;
zmq_msg_t msg1; // Header
zmq_msg_t msg2; // Payload
zmq_msg_t msg3; // Metadata
void *socket = zsock_resolve(sender->zmq.socket);
- zmq_msg_init_data(&msg1, headerData, headerLength,
psa_zmq_freeMsg, bound);
//send header
- int rc = zmq_msg_send(&msg1, socket, ZMQ_SNDMORE);
+ zmq_msg_init_data(&msg1, headerData, headerLength,
psa_zmq_freeMsg, bound);
+ if ((payloadLength > 0) || (metadataLength > 0)) {
+ flags = ZMQ_SNDMORE;
+ }
+
+ int rc = zmq_msg_send(&msg1, socket, flags);
if (rc == -1) {
L_WARN("Error sending header msg. %s", strerror(errno));
zmq_msg_close(&msg1);
}
- //send header
- if (rc > 0) {
+ //send Payload
+ if (rc > 0 && payloadLength > 0) {
zmq_msg_init_data(&msg2, payloadData, payloadLength,
psa_zmq_freeMsg, bound);
- int flags = 0;
if (metadataLength > 0) {
- flags = ZMQ_SNDMORE;
+ flags = ZMQ_SNDMORE;
Review comment:
flags should be reset to 0, since at line 578 it is already set to SNDMORE
if this line is reached.
I thinks "if (metadataLength == 0) flags = 0;" should work..
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services