Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test cases for 232, 235

  • Loading branch information...
commit 231d935947be8365e96e9d9d60f830af82a02f50 1 parent f73fd88
@hintjens hintjens authored
Showing with 18 additions and 8 deletions.
  1. +3 −1 232/2-1/issue.c
  2. +11 −3 232/3-0/issue.c
  3. +4 −4 235/2-1/testcase.c
View
4 232/2-1/issue.c
@@ -27,7 +27,9 @@ int main (void)
}
int64_t rcvmore;
size_t type_size = sizeof (rcvmore);
- zmq_getsockopt (socket, ZMQ_RCVMORE, &rcvmore, &type_size);
+ rc = zmq_getsockopt (pipeout, ZMQ_RCVMORE, &rcvmore, &type_size);
+ assert (rc == 0);
+
printf ("Got first message part: size=%zd more=%d\n",
zmq_msg_size (&msg), (int) rcvmore);
View
14 232/3-0/issue.c
@@ -27,9 +27,17 @@ int main (void)
}
int rcvmore;
size_t type_size = sizeof (int);
- zmq_getsockopt (socket, ZMQ_RCVMORE, &rcvmore, &type_size);
- printf ("Got first message part: size=%zd more=%d\n",
- zmq_msg_size (&msg), rcvmore);
+ rc = zmq_getsockopt (pipeout, ZMQ_RCVMORE, &rcvmore, &type_size);
+ if (rc)
+ puts (strerror (errno));
+ assert (rc == 0);
+
+ int rcvlabel;
+ zmq_getsockopt (pipeout, ZMQ_RCVLABEL, &rcvlabel, &type_size);
+ assert (rc == 0);
+
+ printf ("Got first message part: size=%zd more=%d label=%d\n",
+ zmq_msg_size (&msg), rcvmore, rcvlabel);
return 0;
}
View
8 235/2-1/testcase.c
@@ -60,11 +60,11 @@ int main (void)
// Socket to send messages on
void *sender = zmq_socket (context, ZMQ_PUSH);
- uint64_t hwm = 1;
+ uint64_t hwm = 0;
zmq_setsockopt (sender, ZMQ_HWM, &hwm, sizeof (hwm));
int linger = 0;
zmq_setsockopt (sender, ZMQ_LINGER, &linger, sizeof (linger));
- zmq_bind (sender, "tcp://127.0.0.1:5557");
+ zmq_bind (sender, "tcp://*:5557");
pthread_t worker;
pthread_create (&worker, NULL, worker_task_a, NULL);
@@ -72,7 +72,7 @@ int main (void)
// Wait for threads to connect, since otherwise the messages
// we send will be dropped
- sleep (2);
+ sleep (1);
printf ("Sending tasks to workers...\n");
@@ -84,7 +84,7 @@ int main (void)
for(i = 0; i < 1000000; i++) {
zmq_msg_t task;
zmq_msg_init_data (&task, "Hello world", 11, NULL, NULL);
- rc = zmq_send (sender, &task, ZMQ_NOBLOCK);
+ rc = zmq_send (sender, &task, 0/*ZMQ_NOBLOCK */);
if (rc == 0) {
successful++;
Please sign in to comment.
Something went wrong with that request. Please try again.