diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2013-10-31 13:36:25 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2013-10-31 13:36:25 +0100 |
commit | 25b6c37f8ff90f584fff112240d9c3bc0ce8a1a5 (patch) | |
tree | 96b82f50a6c0e42fb4409afad03fcba9d6bf58c7 /tests/tcp.c | |
parent | 14b9ef53ea8f71258b0eb3ba3d4a5aca482d1691 (diff) | |
download | nanomsg-25b6c37f8ff90f584fff112240d9c3bc0ce8a1a5.tar.gz |
tests for rejected connections added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'tests/tcp.c')
-rw-r--r-- | tests/tcp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tcp.c b/tests/tcp.c index 9e1c0bb..0f4a9ca 100644 --- a/tests/tcp.c +++ b/tests/tcp.c @@ -39,6 +39,7 @@ int main () int i; int opt; size_t sz; + int s1, s2; /* Try closing bound but unconnected socket. */ sb = test_socket (AF_SP, NN_PAIR); @@ -148,6 +149,18 @@ int main () test_close (sc); test_close (sb); + /* Test whether connection rejection is handled decently. */ + sb = test_socket (AF_SP, NN_PAIR); + test_bind (sb, SOCKET_ADDRESS); + s1 = test_socket (AF_SP, NN_PAIR); + test_connect (s1, SOCKET_ADDRESS); + s2 = test_socket (AF_SP, NN_PAIR); + test_connect (s2, SOCKET_ADDRESS); + nn_sleep (100); + test_close (s2); + test_close (s1); + test_close (sb); + return 0; } |