diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-04-09 14:13:29 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-04-10 15:40:06 -0700 |
| commit | 2bf076297f4105c76bfbee0320231e70d0b2b583 (patch) | |
| tree | 879b762ea08cd7d557f0b6ac0d30bad627155891 /tests | |
| parent | 5f7289e1f8e1427c9214c8e3e96ad56b1f868d53 (diff) | |
| download | nng-2bf076297f4105c76bfbee0320231e70d0b2b583.tar.gz nng-2bf076297f4105c76bfbee0320231e70d0b2b583.tar.bz2 nng-2bf076297f4105c76bfbee0320231e70d0b2b583.zip | |
fixes #337 compat_reqrep test too fragile
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compat_reqrep.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/compat_reqrep.c b/tests/compat_reqrep.c index 79bb74bb..36ad15f3 100644 --- a/tests/compat_reqrep.c +++ b/tests/compat_reqrep.c @@ -122,19 +122,26 @@ int main () /* Check sending a request when the peer is not available. (It should - be sent immediatelly when the peer comes online rather than relying - on the resend algorithm. */ + be sent immediately when the peer comes online rather than relying + on the resend algorithm.) */ req1 = test_socket (AF_SP, NN_REQ); timeo = 10; test_setsockopt (req1, NN_SOL_SOCKET, NN_RECONNECT_IVL, &timeo, sizeof (timeo)); - test_send (req1, "ABC"); test_connect (req1, SOCKET_ADDRESS); rep1 = test_socket (AF_SP, NN_REP); test_bind (rep1, SOCKET_ADDRESS); + timeo = 500; test_setsockopt (rep1, NN_SOL_SOCKET, NN_RCVTIMEO, &timeo, sizeof (timeo)); errno_assert (rc == 0); + test_send (req1, "ABC"); + + /* Now close the peer, and reopen it. This should still work. */ + test_close(rep1); + rep1 = test_socket (AF_SP, NN_REP); + test_bind (rep1, SOCKET_ADDRESS); + test_recv (rep1, "ABC"); test_close (req1); @@ -173,11 +180,17 @@ int main () req1 = test_socket (AF_SP, NN_REQ); test_connect (req1, SOCKET_ADDRESS); + + rep1 = test_socket (AF_SP, NN_REP); + test_bind (rep1, SOCKET_ADDRESS); + test_send (req1, "ABC"); test_send (req1, "DEF"); + test_close (rep1); rep1 = test_socket (AF_SP, NN_REP); test_bind (rep1, SOCKET_ADDRESS); + timeo = 100; test_recv (rep1, "DEF"); |
