From ab75b45706adac820f9bf699dddbfcc2c5236f2c Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 15 May 2012 13:20:26 +0200 Subject: pair_tcp test test improved The test now tests whether second connection to a single PAIR socket won't crash the process. Signed-off-by: Martin Sustrik --- tests/pair_tcp.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pair_tcp.cpp b/tests/pair_tcp.cpp index 1df90ad..d406523 100644 --- a/tests/pair_tcp.cpp +++ b/tests/pair_tcp.cpp @@ -40,6 +40,17 @@ int XS_TEST_MAIN () bounce (sb, sc); + // Now let's try to open one more connection to the bound socket. + // The connection should be silently rejected rather than causing error. + void *sc2 = xs_socket (ctx, XS_PAIR); + assert (sc2); + rc = xs_connect (sc2, "tcp://127.0.0.1:5560"); + assert (rc != -1); + sleep (1); + + rc = xs_close (sc2); + assert (rc == 0); + rc = xs_close (sc); assert (rc == 0); -- cgit v1.2.3