Skip to content

Commit

Permalink
Validate reconnect works after pipe close.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Oct 1, 2017
1 parent 869d0ee commit 3399027
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/reconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
});
});
});
});
Expand Down

0 comments on commit 3399027

Please sign in to comment.