aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-12 16:42:35 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-12 16:42:35 -0800
commit06fb7443d839281fb723f95837962a7a26a90d28 (patch)
tree37390acaa736dd94185a3e3902112570dc4ff7b1 /tests
parent4d2661e325c0d0b2fa93642470b66a0c746a72e7 (diff)
downloadnng-06fb7443d839281fb723f95837962a7a26a90d28.tar.gz
nng-06fb7443d839281fb723f95837962a7a26a90d28.tar.bz2
nng-06fb7443d839281fb723f95837962a7a26a90d28.zip
Fixes for survey test. (We need to complete the connection first.)
Diffstat (limited to 'tests')
-rw-r--r--tests/survey.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/survey.c b/tests/survey.c
index 237d7e2a..a3b6f0ae 100644
--- a/tests/survey.c
+++ b/tests/survey.c
@@ -77,6 +77,7 @@ Main({
Convey("We can create a linked survey pair", {
nng_socket *surv;
nng_socket *resp;
+ nng_socket *sock;
uint64_t expire;
So((rv = nng_open(&surv, NNG_PROTO_SURVEYOR)) == 0);
@@ -85,17 +86,26 @@ Main({
So((rv = nng_open(&resp, NNG_PROTO_RESPONDENT)) == 0);
So(resp != NULL);
+
Reset({
nng_close(surv);
nng_close(resp);
})
- expire = 10000;
+ expire = 40000;
So(nng_setopt(surv, NNG_OPT_SURVEYTIME, &expire, sizeof (expire)) == 0);
So(nng_listen(surv, addr, NULL, NNG_FLAG_SYNCH) == 0);
So(nng_dial(resp, addr, NULL, NNG_FLAG_SYNCH) == 0);
+ // We dial another socket as that will force the
+ // earlier dial to have completed *fully*. This is a
+ // hack that only works because our listen logic is
+ // single threaded.
+ So((rv = nng_open(&sock, NNG_PROTO_RESPONDENT)) == 0);
+ So(nng_dial(sock, addr, NULL, NNG_FLAG_SYNCH) == 0);
+ nng_close(sock);
+
Convey("Survey works", {
nng_msg *msg;
uint64_t rtimeo;