aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-24 15:22:36 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-24 15:22:36 -0800
commit3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2 (patch)
treedf080f601ec6e050c2a7a4df7a7b728aa7d0d2fb /tests
parentcb4fe7294f7da2ad1a2fdf896748b42e1a8115ab (diff)
downloadnng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.gz
nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.bz2
nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.zip
Expose nng_sendmsg.
Diffstat (limited to 'tests')
-rw-r--r--tests/sock.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/sock.c b/tests/sock.c
index 931e114a..65ed5565 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -54,6 +54,27 @@ TestMain("Socket Operations", {
So(msg == NULL);
})
+ Convey("Send with no pipes times out correctly", {
+ nng_msg *msg = NULL;
+ int64_t when = 500000;
+ uint64_t now;
+
+ // We cheat to get access to the core's clock.
+ So(nng_msg_alloc(&msg, 0) == 0);
+ So(msg != NULL);
+ extern uint64_t nni_clock(void);
+ now = nni_clock();
+
+ rv = nng_setopt(sock, NNG_OPT_SNDTIMEO, &when,
+ sizeof (when));
+ So(rv == 0);
+ rv = nng_sendmsg(sock, msg, 0);
+ So(rv == NNG_ETIMEDOUT);
+ So(nni_clock() > (now + 500000));
+ So(nni_clock() < (now + 1000000));
+ nng_msg_free(msg);
+ })
+
Convey("We can set and get options", {
int64_t when = 1234;
int64_t check = 0;