aboutsummaryrefslogtreecommitdiff
path: root/src/nng.c
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 /src/nng.c
parentcb4fe7294f7da2ad1a2fdf896748b42e1a8115ab (diff)
downloadnng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.gz
nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.bz2
nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.zip
Expose nng_sendmsg.
Diffstat (limited to 'src/nng.c')
-rw-r--r--src/nng.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nng.c b/src/nng.c
index 225bf074..5a0acaac 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -70,6 +70,27 @@ nng_recvmsg(nng_socket *s, nng_msg **msgp, int flags)
return (nni_socket_recvmsg(s, msgp, expire));
}
+int
+nng_sendmsg(nng_socket *s, nng_msg *msg, int flags)
+{
+ int rv;
+ nni_time expire;
+
+ if ((rv = nni_init()) != 0) {
+ return (rv);
+ }
+
+ if ((flags == NNG_FLAG_NONBLOCK) || (s->s_sndtimeo == 0)) {
+ expire = NNI_TIME_ZERO;
+ } else if (s->s_sndtimeo < 0) {
+ expire = NNI_TIME_NEVER;
+ } else {
+ expire = nni_clock() + s->s_sndtimeo;
+ }
+
+ return (nni_socket_sendmsg(s, msg, expire));
+}
+
int
nng_setopt(nng_socket *s, int opt, const void *val, size_t sz)