aboutsummaryrefslogtreecommitdiff
path: root/tests/zt.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-01-24 17:38:16 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-01 16:11:38 -0800
commit3dae30ed5e543dc73fc993334ef56b9b157b9b3c (patch)
treed7e294b5d544aa18e8fc8749abfe605a05fa4bd7 /tests/zt.c
parent5914e40c2ff7fcf346c90705785f3fb7650a9fdc (diff)
downloadnng-3dae30ed5e543dc73fc993334ef56b9b157b9b3c.tar.gz
nng-3dae30ed5e543dc73fc993334ef56b9b157b9b3c.tar.bz2
nng-3dae30ed5e543dc73fc993334ef56b9b157b9b3c.zip
fixes #173 Define public HTTP server API
This introduces enough of the HTTP API to support fully server applications, including creation of websocket style protocols, pluggable handlers, and so forth. We have also introduced scatter/gather I/O (rudimentary) for aios, and made other enhancements to the AIO framework. The internals of the AIOs themselves are now fully private, and we have eliminated the aio->a_addr member, with plans to remove the pipe and possibly message members as well. A few other minor issues were found and fixed as well. The HTTP API includes request, response, and connection objects, which can be used with both servers and clients. It also defines the HTTP server and handler objects, which support server applications. Support for client applications will require a client object to be exposed, and that should be happening shortly. None of this is "documented" yet, bug again, we will follow up shortly.
Diffstat (limited to 'tests/zt.c')
-rw-r--r--tests/zt.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/tests/zt.c b/tests/zt.c
index 8775d0b3..02e098fa 100644
--- a/tests/zt.c
+++ b/tests/zt.c
@@ -184,6 +184,17 @@ check_props(nng_msg *msg, nng_listener l, nng_dialer d)
So(mtu >= 1000 && mtu <= 10000);
});
+ Convey("Network name property works", {
+ char name[NNG_MAXADDRLEN];
+ size_t namesz;
+ int status;
+
+ namesz = sizeof(name);
+ So(nng_listener_getopt(
+ l, NNG_OPT_ZT_NETWORK_NAME, name, &namesz) == 0);
+ So(strcmp(name, "nng_test_open") == 0);
+ });
+
return (0);
}
@@ -280,20 +291,6 @@ TestMain("ZeroTier Transport", {
0);
So(node1 != 0);
- Convey("Network name & status options work", {
- char name[NNG_MAXADDRLEN];
- size_t namesz;
- int status;
-
- namesz = sizeof(name);
- nng_msleep(10000);
- So(nng_listener_getopt(l, NNG_OPT_ZT_NETWORK_NAME,
- name, &namesz) == 0);
- So(strcmp(name, "nng_test_open") == 0);
- So(nng_listener_getopt_int(
- l, NNG_OPT_ZT_NETWORK_STATUS, &status) == 0);
- So(status == nng_zt_network_status_ok);
- });
Convey("Connection refused works", {
snprintf(addr, sizeof(addr), "zt://%llx." NWID ":%u",
(unsigned long long) node1, 42u);
@@ -315,7 +312,6 @@ TestMain("ZeroTier Transport", {
uint64_t node;
port = 9944;
- // uint64_t node = 0xb000072fa6ull; // my personal host
So(nng_zt_register() == 0);
snprintf(addr1, sizeof(addr1), "zt://*." NWID ":%u", port);
@@ -324,8 +320,7 @@ TestMain("ZeroTier Transport", {
So(nng_pair_open(&s2) == 0);
Reset({
nng_close(s1);
- // This sleep allows us to ensure disconnect
- // messages work.
+ // This sleep ensures disconnect messages work.
nng_msleep(500);
nng_close(s2);
});
@@ -345,7 +340,7 @@ TestMain("ZeroTier Transport", {
So(nng_dialer_setopt(
d, NNG_OPT_ZT_HOME, path2, strlen(path2) + 1) == 0);
So(nng_dialer_start(d, 0) == 0);
- nng_msleep(2000);
+ nng_msleep(2000); // to give dialer time to start up
});
trantest_test_extended("zt://*." NWID ":%u", check_props);