diff options
| author | Garrett D'Amore <garrett@damore.org> | 2016-12-24 15:22:36 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2016-12-24 15:22:36 -0800 |
| commit | 3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2 (patch) | |
| tree | df080f601ec6e050c2a7a4df7a7b728aa7d0d2fb /src/nng.c | |
| parent | cb4fe7294f7da2ad1a2fdf896748b42e1a8115ab (diff) | |
| download | nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.gz nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.tar.bz2 nng-3bed9dca3a3ae5b226e3bf6aee3352d7665dbcc2.zip | |
Expose nng_sendmsg.
Diffstat (limited to 'src/nng.c')
| -rw-r--r-- | src/nng.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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) |
