summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:11 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:11 +0900
commitcfba1f07987434263843f4aaee11ec088ec6ced3 (patch)
tree68f3c384b1cd582c8c3fd9d096d482b7390c8b00
parenteea0209ceaf59b9011a4b536ca9b47014504ac92 (diff)
Reconnect test extended to include IPC
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--tests/test_reconnect.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_reconnect.cpp b/tests/test_reconnect.cpp
index af1b3c1..9a62e1c 100644
--- a/tests/test_reconnect.cpp
+++ b/tests/test_reconnect.cpp
@@ -57,6 +57,33 @@ int main (int argc, char *argv [])
assert (rc == 0);
rc = xs_close (pull);
assert (rc == 0);
+
+ // Now, let's test the same scenario with IPC.
+ push = xs_socket (ctx, XS_PUSH);
+ assert (push);
+ pull = xs_socket (ctx, XS_PULL);
+ assert (push);
+
+ // Connect before bind was done at the peer and send one message.
+ rc = xs_connect (push, "ipc:///tmp/tester");
+ assert (rc == 0);
+ rc = xs_send (push, "ABC", 3, 0);
+ assert (rc == 3);
+
+ // Wait a while for few attempts to reconnect to happen.
+ xs_sleep (1);
+
+ // Bind the peer and get the message.
+ rc = xs_bind (pull, "ipc:///tmp/tester");
+ assert (rc == 0);
+ rc = xs_recv (pull, buf, sizeof (buf), 0);
+ assert (rc == 3);
+
+ // Clean up.
+ rc = xs_close (push);
+ assert (rc == 0);
+ rc = xs_close (pull);
+ assert (rc == 0);
rc = xs_term (ctx);
assert (rc == 0);