aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-09-30 18:04:35 -0700
committerGarrett D'Amore <garrett@damore.org>2017-09-30 18:04:35 -0700
commit33990278f78ab743ac9c4220c537063ce5790d16 (patch)
tree75b33512e4f8d28138117aeddb9b93ef568e59e9
parent869d0eeb20657cd6d2e87d8c4836b086c6be448d (diff)
downloadnng-33990278f78ab743ac9c4220c537063ce5790d16.tar.gz
nng-33990278f78ab743ac9c4220c537063ce5790d16.tar.bz2
nng-33990278f78ab743ac9c4220c537063ce5790d16.zip
Validate reconnect works after pipe close.
-rw-r--r--tests/reconnect.c19
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);
+ });
});
});
});