diff options
Diffstat (limited to 'src/core/options.c')
| -rw-r--r-- | src/core/options.c | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/src/core/options.c b/src/core/options.c index 3b787b82..1417d0b3 100644 --- a/src/core/options.c +++ b/src/core/options.c @@ -220,63 +220,4 @@ nni_getopt_buf(nni_msgq *mq, void *val, size_t *sizep) memcpy(val, &len, sz); *sizep = sizeof(len); return (0); -} - -static void -nni_notifyfd_push(struct nng_event *ev, void *arg) -{ - nni_notifyfd *fd = arg; - - NNI_ARG_UNUSED(ev); - - nni_plat_pipe_raise(fd->sn_wfd); -} - -int -nni_getopt_fd(nni_sock *s, nni_notifyfd *fd, int mask, void *val, size_t *szp) -{ - int rv; - uint32_t flags; - - if ((*szp < sizeof(int))) { - return (NNG_EINVAL); - } - - flags = nni_sock_flags(s); - - switch (mask) { - case NNG_EV_CAN_SND: - if ((flags & NNI_PROTO_FLAG_SND) == 0) { - return (NNG_ENOTSUP); - } - break; - case NNG_EV_CAN_RCV: - if ((flags & NNI_PROTO_FLAG_RCV) == 0) { - return (NNG_ENOTSUP); - } - break; - default: - return (NNG_ENOTSUP); - } - - // If we already inited this, just give back the same file descriptor. - if (fd->sn_init) { - memcpy(val, &fd->sn_rfd, sizeof(int)); - *szp = sizeof(int); - return (0); - } - - if ((rv = nni_plat_pipe_open(&fd->sn_wfd, &fd->sn_rfd)) != 0) { - return (rv); - } - - if (nni_sock_notify(s, mask, nni_notifyfd_push, fd) == NULL) { - nni_plat_pipe_close(fd->sn_wfd, fd->sn_rfd); - return (NNG_ENOMEM); - } - - fd->sn_init = 1; - *szp = sizeof(int); - memcpy(val, &fd->sn_rfd, sizeof(int)); - return (0); -} +}
\ No newline at end of file |
