aboutsummaryrefslogtreecommitdiff
path: root/tests/pubsub.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-24 16:27:53 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-24 16:27:53 -0700
commit2e5f47aed81992a8dba4b27823894507794fc0ad (patch)
tree2383f0139d6931efbbc20ac63be6dfbc1f6e1279 /tests/pubsub.c
parentc9a68bfe6bea2acc708bf49045f6cb65017a3306 (diff)
downloadnng-2e5f47aed81992a8dba4b27823894507794fc0ad.tar.gz
nng-2e5f47aed81992a8dba4b27823894507794fc0ad.tar.bz2
nng-2e5f47aed81992a8dba4b27823894507794fc0ad.zip
Fix a few warnings and subtle test races.
Diffstat (limited to 'tests/pubsub.c')
-rw-r--r--tests/pubsub.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/pubsub.c b/tests/pubsub.c
index de2fcfc5..3bdd8f8c 100644
--- a/tests/pubsub.c
+++ b/tests/pubsub.c
@@ -77,11 +77,12 @@ TestMain("PUB/SUB pattern", {
// and the sub dial. However, this creates a problem
// for our tests, since we can wind up trying to push
// data before the pipe is fully registered (the accept
- // runs asynchronously.) Doing the reverse here
- // ensures that we won't lose data.
+ // runs asynchronously.)
So(nng_listen(sub, addr, NULL, 0) == 0);
So(nng_dial(pub, addr, NULL, 0) == 0);
+ nng_usleep(20000); // give time for connecting threads
+
Convey("Sub can subscribe", {
So(nng_setopt(
sub, nng_optid_sub_subscribe, "ABC", 3) == 0);