aboutsummaryrefslogtreecommitdiff
path: root/tests/sock.c
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/sock.c
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/sock.c')
-rw-r--r--tests/sock.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/sock.c b/tests/sock.c
index 81c0eb59..21b12792 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -113,6 +113,32 @@ TestMain("Socket Operations", {
NNG_EINVAL);
});
+ Convey("URL option works", {
+ char url[NNG_MAXADDRLEN];
+ nng_listener l;
+ nng_dialer d;
+ size_t sz;
+
+ So(nng_listener_create(
+ &l, s1, "inproc://url1") == 0);
+ So(nng_dialer_create(
+ &d, s1, "inproc://url2") == 0);
+ memset(url, 0, sizeof(url));
+ sz = sizeof(url);
+ So(nng_listener_getopt(
+ l, nng_optid_url, url, &sz) == 0);
+ So(strcmp(url, "inproc://url1") == 0);
+ sz = sizeof(url);
+ So(nng_dialer_getopt(
+ d, nng_optid_url, url, &sz) == 0);
+ So(strcmp(url, "inproc://url2") == 0);
+
+ Reset({
+ nng_dialer_close(d);
+ nng_listener_close(l);
+ })
+ });
+
Convey("We can apply options before endpoint", {
nng_listener l;
char addr[NNG_MAXADDRLEN];