aboutsummaryrefslogtreecommitdiff
path: root/tests/trantest.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-09-20 12:11:53 -0700
committerGarrett D'Amore <garrett@damore.org>2017-09-22 12:33:50 -0700
commite236dc8141f4d00dc926fbfba7739dabf96ebcdd (patch)
tree3c88190966eac4d888008d5076e7edd1817f64a2 /tests/trantest.h
parentf04cfd27e2d67b0fc89b079410fc11b55b6d1979 (diff)
downloadnng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.tar.gz
nng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.tar.bz2
nng-e236dc8141f4d00dc926fbfba7739dabf96ebcdd.zip
More pipe option handling, pipe API support. Url option.
This fleshes most of the pipe API out, making it available to end user code. It also adds a URL option that is independent of the address options (which would be sockaddrs.) Also, we are now setting the pipe for req/rep. The other protocols need to have the same logic added to set the receive pipe on the message. (Pair is already done.)
Diffstat (limited to 'tests/trantest.h')
-rw-r--r--tests/trantest.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/trantest.h b/tests/trantest.h
index 84b54e34..d4d65eee 100644
--- a/tests/trantest.h
+++ b/tests/trantest.h
@@ -128,6 +128,9 @@ trantest_send_recv(trantest *tt)
nng_msg * send;
nng_msg * recv;
size_t len;
+ nng_pipe p;
+ char url[NNG_MAXADDRLEN];
+ size_t sz;
So(nng_listen(tt->repsock, tt->addr, &l, 0) == 0);
So(l != 0);
@@ -155,8 +158,13 @@ trantest_send_recv(trantest *tt)
So(recv != NULL);
So(nng_msg_len(recv) == strlen("acknowledge"));
So(strcmp(nng_msg_body(recv), "acknowledge") == 0);
+ p = nng_msg_get_pipe(recv);
+ So(p != 0);
+ sz = sizeof (url);
+ So(nng_pipe_getopt(p, nng_optid_url, url, &sz) == 0);
+ So(strcmp(url, tt->addr) == 0);
nng_msg_free(recv);
- })
+ });
}
void
trantest_test_all(const char *addr)