diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-14 21:58:02 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-14 21:58:02 -0700 |
| commit | b47a223bfb2c7114154504ec8d6cdac5abd0b884 (patch) | |
| tree | a9f70f7e3ca9d00a77fb2026daf5f1c3ba0cf013 /tests | |
| parent | 6655557fca28408e0eeac3ba80b9e2bbdeada389 (diff) | |
| download | nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.tar.gz nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.tar.bz2 nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.zip | |
Convert duration to usec.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/pair1.c | 14 | ||||
| -rw-r--r-- | tests/reqrep.c | 2 | ||||
| -rw-r--r-- | tests/sock.c | 18 |
3 files changed, 16 insertions, 18 deletions
diff --git a/tests/pair1.c b/tests/pair1.c index aa86883b..08691fd4 100644 --- a/tests/pair1.c +++ b/tests/pair1.c @@ -44,11 +44,11 @@ TestMain("PAIRv1 protocol", { So(nng_pair1_open(&c2) == 0); tmo = 300000; - So(nng_setopt_duration(s1, NNG_OPT_RCVTIMEO, tmo) == 0); - So(nng_setopt_duration(c1, NNG_OPT_RCVTIMEO, tmo) == 0); - So(nng_setopt_duration(c2, NNG_OPT_RCVTIMEO, tmo) == 0); + So(nng_setopt_usec(s1, NNG_OPT_RCVTIMEO, tmo) == 0); + So(nng_setopt_usec(c1, NNG_OPT_RCVTIMEO, tmo) == 0); + So(nng_setopt_usec(c2, NNG_OPT_RCVTIMEO, tmo) == 0); tmo = 0; - So(nng_getopt_duration(s1, NNG_OPT_RCVTIMEO, &tmo) == 0); + So(nng_getopt_usec(s1, NNG_OPT_RCVTIMEO, &tmo) == 0); So(tmo == 300000); Convey("Monogamous cooked mode works", { @@ -113,8 +113,7 @@ TestMain("PAIRv1 protocol", { So(nng_setopt_int(s1, NNG_OPT_RCVBUF, 1) == 0); So(nng_setopt_int(s1, NNG_OPT_SNDBUF, 1) == 0); So(nng_setopt_int(c1, NNG_OPT_RCVBUF, 1) == 0); - So(nng_setopt_duration(s1, NNG_OPT_SNDTIMEO, 100000) == - 0); + So(nng_setopt_usec(s1, NNG_OPT_SNDTIMEO, 100000) == 0); So(nng_listen(s1, addr, NULL, 0) == 0); So(nng_dial(c1, addr, NULL, 0) == 0); @@ -138,8 +137,7 @@ TestMain("PAIRv1 protocol", { So(nng_setopt_int(s1, NNG_OPT_RCVBUF, 1) == 0); So(nng_setopt_int(s1, NNG_OPT_SNDBUF, 1) == 0); So(nng_setopt_int(c1, NNG_OPT_RCVBUF, 1) == 0); - So(nng_setopt_duration(s1, NNG_OPT_SNDTIMEO, 30000) == - 0); + So(nng_setopt_usec(s1, NNG_OPT_SNDTIMEO, 30000) == 0); So(nng_listen(s1, addr, NULL, 0) == 0); So(nng_dial(c1, addr, NULL, 0) == 0); diff --git a/tests/reqrep.c b/tests/reqrep.c index b27af5ac..e36232b6 100644 --- a/tests/reqrep.c +++ b/tests/reqrep.c @@ -115,7 +115,7 @@ TestMain("REQ/REP pattern", { nng_close(req); }); - So(nng_setopt_duration(req, NNG_OPT_RESENDTIME, retry) == 0); + So(nng_setopt_usec(req, NNG_OPT_RESENDTIME, retry) == 0); So(nng_setopt_int(req, NNG_OPT_SNDBUF, 16) == 0); So(nng_msg_alloc(&abc, 0) == 0); diff --git a/tests/sock.c b/tests/sock.c index 31d48333..d33b0c81 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -60,7 +60,7 @@ TestMain("Socket Operations", { now = nng_clock(); So(now > 0); - So(nng_setopt_duration(s1, NNG_OPT_RCVTIMEO, to) == 0); + So(nng_setopt_usec(s1, NNG_OPT_RCVTIMEO, to) == 0); So(nng_recvmsg(s1, &msg, 0) == NNG_ETIMEDOUT); So(msg == NULL); So(nng_clock() >= (now + to)); @@ -84,7 +84,7 @@ TestMain("Socket Operations", { So(msg != NULL); now = nng_clock(); - So(nng_setopt_duration(s1, NNG_OPT_SNDTIMEO, to) == 0); + So(nng_setopt_usec(s1, NNG_OPT_SNDTIMEO, to) == 0); So(nng_sendmsg(s1, msg, 0) == NNG_ETIMEDOUT); So(nng_clock() >= (now + to)); So(nng_clock() < (now + (to * 2))); @@ -96,7 +96,7 @@ TestMain("Socket Operations", { int64_t v = 0; size_t sz; - So(nng_setopt_duration(s1, NNG_OPT_SNDTIMEO, to) == 0); + So(nng_setopt_usec(s1, NNG_OPT_SNDTIMEO, to) == 0); Convey("Short size is not copied", { sz = 0; @@ -129,8 +129,8 @@ TestMain("Socket Operations", { }); Convey("Negative timeout fails", { - So(nng_setopt_duration(s1, NNG_OPT_RCVTIMEO, - -5) == NNG_EINVAL); + So(nng_setopt_usec(s1, NNG_OPT_RCVTIMEO, -5) == + NNG_EINVAL); }); Convey("Short timeout fails", { @@ -256,10 +256,10 @@ TestMain("Socket Operations", { So(nng_setopt_int(s1, NNG_OPT_SNDBUF, 1) == 0); So(nng_setopt_int(s2, NNG_OPT_SNDBUF, 1) == 0); - So(nng_setopt_duration(s1, NNG_OPT_SNDTIMEO, to) == 0); - So(nng_setopt_duration(s1, NNG_OPT_RCVTIMEO, to) == 0); - So(nng_setopt_duration(s2, NNG_OPT_SNDTIMEO, to) == 0); - So(nng_setopt_duration(s2, NNG_OPT_RCVTIMEO, to) == 0); + So(nng_setopt_usec(s1, NNG_OPT_SNDTIMEO, to) == 0); + So(nng_setopt_usec(s1, NNG_OPT_RCVTIMEO, to) == 0); + So(nng_setopt_usec(s2, NNG_OPT_SNDTIMEO, to) == 0); + So(nng_setopt_usec(s2, NNG_OPT_RCVTIMEO, to) == 0); So(nng_listen(s1, a, NULL, 0) == 0); So(nng_dial(s2, a, NULL, 0) == 0); |
