diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-09-30 18:04:35 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-09-30 18:04:35 -0700 |
| commit | 33990278f78ab743ac9c4220c537063ce5790d16 (patch) | |
| tree | 75b33512e4f8d28138117aeddb9b93ef568e59e9 | |
| parent | 869d0eeb20657cd6d2e87d8c4836b086c6be448d (diff) | |
| download | nng-33990278f78ab743ac9c4220c537063ce5790d16.tar.gz nng-33990278f78ab743ac9c4220c537063ce5790d16.tar.bz2 nng-33990278f78ab743ac9c4220c537063ce5790d16.zip | |
Validate reconnect works after pipe close.
| -rw-r--r-- | tests/reconnect.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/reconnect.c b/tests/reconnect.c index 4c5ff645..4324a84b 100644 --- a/tests/reconnect.c +++ b/tests/reconnect.c @@ -64,6 +64,7 @@ TestMain("Reconnect works", { Convey("They still exchange frames", { nng_msg *msg; + nng_pipe p1; nng_usleep(100000); So(nng_msg_alloc(&msg, 0) == 0); @@ -73,7 +74,25 @@ TestMain("Reconnect works", { So(nng_recvmsg(pull, &msg, 0) == 0); So(msg != NULL); CHECKSTR(msg, "hello"); + p1 = nng_msg_get_pipe(msg); nng_msg_free(msg); + + Convey("Even after pipe close", { + nng_pipe p2; + + nng_pipe_close(p1); + nng_usleep(100000); + So(nng_msg_alloc(&msg, 0) == 0); + APPENDSTR(msg, "again"); + So(nng_sendmsg(push, msg, 0) == 0); + msg = NULL; + So(nng_recvmsg(pull, &msg, 0) == 0); + So(msg != NULL); + CHECKSTR(msg, "again"); + p2 = nng_msg_get_pipe(msg); + nng_msg_free(msg); + So(p2 != p1); + }); }); }); }); |
