aboutsummaryrefslogtreecommitdiff
path: root/tests/device.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-19 15:16:25 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-19 17:56:49 -0700
commit4e668fdd5b5da0d46f97d835249dbe5f0ea319a7 (patch)
tree0aaad8a672024b3a510763150b167320be6f1f5b /tests/device.c
parentd7e39a2423212a31c5ef62dcb0b7a5b4bf9f34df (diff)
downloadnng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.tar.gz
nng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.tar.bz2
nng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.zip
fixes #84 Consider using msec for durations
There is now a public nng_duration type. We have also updated the zerotier work to work with the signed int64_t's that the latst ZeroTier dev branch is using.
Diffstat (limited to 'tests/device.c')
-rw-r--r--tests/device.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/device.c b/tests/device.c
index d1e08449..5c650a91 100644
--- a/tests/device.c
+++ b/tests/device.c
@@ -31,6 +31,8 @@ dodev(void *arg)
nng_device(d->s1, d->s2);
}
+#define SECOND(x) ((x) *1000)
+
Main({
Test("PAIRv1 device", {
@@ -38,13 +40,13 @@ Main({
const char *addr2 = "inproc://dev2";
Convey("We can create a PAIRv1 device", {
- nng_socket dev1;
- nng_socket dev2;
- nng_socket end1;
- nng_socket end2;
- uint64_t tmo;
- nng_msg * msg;
- void * thr;
+ nng_socket dev1;
+ nng_socket dev2;
+ nng_socket end1;
+ nng_socket end2;
+ nng_duration tmo;
+ nng_msg * msg;
+ void * thr;
So(nng_pair1_open(&dev1) == 0);
So(nng_pair1_open(&dev2) == 0);
@@ -72,11 +74,11 @@ Main({
So(nng_dial(end1, addr1, NULL, 0) == 0);
So(nng_dial(end2, addr2, NULL, 0) == 0);
- tmo = 1000000;
- So(nng_setopt_usec(end1, NNG_OPT_RECVTIMEO, tmo) == 0);
- So(nng_setopt_usec(end2, NNG_OPT_RECVTIMEO, tmo) == 0);
+ tmo = SECOND(1);
+ So(nng_setopt_ms(end1, NNG_OPT_RECVTIMEO, tmo) == 0);
+ So(nng_setopt_ms(end2, NNG_OPT_RECVTIMEO, tmo) == 0);
- nng_usleep(100000);
+ nng_msleep(100);
Convey("Device can send and receive", {
So(nng_msg_alloc(&msg, 0) == 0);