diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-05-15 13:20:26 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-05-15 13:20:26 +0200 |
commit | ab75b45706adac820f9bf699dddbfcc2c5236f2c (patch) | |
tree | a894a2cea516da1c1bcee8d0c93641659e5fa45b | |
parent | adbd29bfa16ae4d58c767d4b03e28841c7cd7fc5 (diff) |
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 <sustrik@250bpm.com>
-rw-r--r-- | tests/pair_tcp.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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); |