I made a lot of change to the clone 6 pattern to suite our system. However
it was very unstable, with memory read/write access error sometimes, and
corrupted messages also sometimes. After debugging, the issue is with INPROC
connection. If sending small messages (254b), it works perfect. However I
have no control of how large messages would be (upper business process
decides), sometimes it is 9000b (list of client orders).
My temporary solution is to break large messages into small ones (max at
254b).
Self->pipe is INPROC connection
void
clone_set_mem (clone_t *self, byte *key, int64_t klength, byte *value,
int64_t vlength, int ttl)
{
zmsg_t *msg = zmsg_new ();
char ttlstr [10];
char vlstr [40];
int64_t rc = 0;
sprintf (ttlstr, "%d", ttl);
sprintf (vlstr, "%I64d", vlength);
zmsg_addstr (msg, "SET");
zmsg_addmem (msg, key, klength);
zmsg_addstr (msg, ttlstr);
zmsg_addstr (msg, vlstr);
while (rc < vlength) {
char * new_start = value + rc;
zmsg_addmem (msg, new_start, vlength - rc);
rc +=254;
}
zmsg_send (&msg, self->pipe);
}
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev