From fa986e725f08e30eab68e16765b2cf71613b871c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 3 May 2018 11:13:36 -0700 Subject: Fix failures in pipe test on Windows. The problem was that with inproc we could wind up calling the completion callback before actually returning the dialer ID to the structure, leading to false comparison failures. Creating the dialer and listener in separate steps ensures that we have IDs in place for them before any callback might be issued. Note that this was a bug in the test logic only, and not a problem with the underlying implementation. --- tests/pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/pipe.c') diff --git a/tests/pipe.c b/tests/pipe.c index d5481c10..b81f72b8 100644 --- a/tests/pipe.c +++ b/tests/pipe.c @@ -85,11 +85,13 @@ TestMain("Pipe notify works", { So(nng_setopt_ms(push.s, NNG_OPT_RECONNMAXT, 10) == 0); Convey("Dialing works", { - So(nng_listen(pull.s, addr, &pull.l, 0) == 0); + So(nng_listener_create(&pull.l, pull.s, addr) == 0); + So(nng_dialer_create(&push.d, push.s, addr) == 0); So(nng_listener_id(pull.l) > 0); - So(nng_dial(push.s, addr, &push.d, 0) == 0); So(nng_dialer_id(push.d) > 0); - nng_msleep(200); + So(nng_listener_start(pull.l, 0) == 0); + So(nng_dialer_start(push.d, 0) == 0); + nng_msleep(100); So(pull.add == 1); So(pull.rem == 0); So(pull.err == 0); @@ -99,7 +101,6 @@ TestMain("Pipe notify works", { Convey("We can send a frame", { nng_msg *msg; - nng_msleep(200); So(nng_msg_alloc(&msg, 0) == 0); APPENDSTR(msg, "hello"); So(nng_sendmsg(push.s, msg, 0) == 0); -- cgit v1.2.3-70-g09d2