diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-14 21:58:02 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-14 21:58:02 -0700 |
| commit | b47a223bfb2c7114154504ec8d6cdac5abd0b884 (patch) | |
| tree | a9f70f7e3ca9d00a77fb2026daf5f1c3ba0cf013 /src | |
| parent | 6655557fca28408e0eeac3ba80b9e2bbdeada389 (diff) | |
| download | nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.tar.gz nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.tar.bz2 nng-b47a223bfb2c7114154504ec8d6cdac5abd0b884.zip | |
Convert duration to usec.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/options.c | 4 | ||||
| -rw-r--r-- | src/core/options.h | 4 | ||||
| -rw-r--r-- | src/core/socket.c | 26 | ||||
| -rw-r--r-- | src/core/socket.h | 5 | ||||
| -rw-r--r-- | src/nng.c | 4 | ||||
| -rw-r--r-- | src/nng.h | 4 | ||||
| -rw-r--r-- | src/protocol/reqrep/req.c | 4 | ||||
| -rw-r--r-- | src/protocol/survey/survey.c | 4 |
8 files changed, 24 insertions, 31 deletions
diff --git a/src/core/options.c b/src/core/options.c index 170e7407..403630a3 100644 --- a/src/core/options.c +++ b/src/core/options.c @@ -13,7 +13,7 @@ #include <string.h> int -nni_setopt_duration(nni_duration *ptr, const void *val, size_t size) +nni_setopt_usec(nni_duration *ptr, const void *val, size_t size) { nni_duration dur; @@ -68,7 +68,7 @@ nni_setopt_size( } int -nni_getopt_duration(nni_duration *ptr, void *val, size_t *sizep) +nni_getopt_usec(nni_duration *ptr, void *val, size_t *sizep) { size_t sz = sizeof(*ptr); diff --git a/src/core/options.h b/src/core/options.h index 4f958e55..8e6e1edf 100644 --- a/src/core/options.h +++ b/src/core/options.h @@ -22,10 +22,10 @@ extern int nni_getopt_buf(nni_msgq *, void *, size_t *); // nni_setopt_duration sets the duration. Durations must be legal, // either a positive value, 0, or -1 to indicate forever. -extern int nni_setopt_duration(nni_duration *, const void *, size_t); +extern int nni_setopt_usec(nni_duration *, const void *, size_t); // nni_getopt_duration gets the duration. -extern int nni_getopt_duration(nni_duration *, void *, size_t *); +extern int nni_getopt_usec(nni_duration *, void *, size_t *); // nni_setopt_int sets an integer, which must be between the minimum and // maximum values (inclusive). diff --git a/src/core/socket.c b/src/core/socket.c index 51ea9b55..541c2383 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -632,12 +632,6 @@ nni_sock_peer(nni_sock *sock) return (sock->s_peer_id.p_id); } -nni_duration -nni_sock_linger(nni_sock *sock) -{ - return (sock->s_linger); -} - size_t nni_sock_rcvmaxsz(nni_sock *sock) { @@ -712,19 +706,19 @@ nni_sock_setopt(nni_sock *sock, int opt, const void *val, size_t size) } switch (opt) { case NNG_OPT_LINGER: - rv = nni_setopt_duration(&sock->s_linger, val, size); + rv = nni_setopt_usec(&sock->s_linger, val, size); break; case NNG_OPT_SNDTIMEO: - rv = nni_setopt_duration(&sock->s_sndtimeo, val, size); + rv = nni_setopt_usec(&sock->s_sndtimeo, val, size); break; case NNG_OPT_RCVTIMEO: - rv = nni_setopt_duration(&sock->s_rcvtimeo, val, size); + rv = nni_setopt_usec(&sock->s_rcvtimeo, val, size); break; case NNG_OPT_RECONN_TIME: - rv = nni_setopt_duration(&sock->s_reconn, val, size); + rv = nni_setopt_usec(&sock->s_reconn, val, size); break; case NNG_OPT_RECONN_MAXTIME: - rv = nni_setopt_duration(&sock->s_reconnmax, val, size); + rv = nni_setopt_usec(&sock->s_reconnmax, val, size); break; case NNG_OPT_SNDBUF: rv = nni_setopt_buf(sock->s_uwq, val, size); @@ -762,19 +756,19 @@ nni_sock_getopt(nni_sock *sock, int opt, void *val, size_t *sizep) switch (opt) { case NNG_OPT_LINGER: - rv = nni_getopt_duration(&sock->s_linger, val, sizep); + rv = nni_getopt_usec(&sock->s_linger, val, sizep); break; case NNG_OPT_SNDTIMEO: - rv = nni_getopt_duration(&sock->s_sndtimeo, val, sizep); + rv = nni_getopt_usec(&sock->s_sndtimeo, val, sizep); break; case NNG_OPT_RCVTIMEO: - rv = nni_getopt_duration(&sock->s_rcvtimeo, val, sizep); + rv = nni_getopt_usec(&sock->s_rcvtimeo, val, sizep); break; case NNG_OPT_RECONN_TIME: - rv = nni_getopt_duration(&sock->s_reconn, val, sizep); + rv = nni_getopt_usec(&sock->s_reconn, val, sizep); break; case NNG_OPT_RECONN_MAXTIME: - rv = nni_getopt_duration(&sock->s_reconnmax, val, sizep); + rv = nni_getopt_usec(&sock->s_reconnmax, val, sizep); break; case NNG_OPT_SNDBUF: rv = nni_getopt_buf(sock->s_uwq, val, sizep); diff --git a/src/core/socket.h b/src/core/socket.h index 94dd816d..9b7ac1f9 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -112,8 +112,7 @@ extern nni_msgq *nni_sock_sendq(nni_sock *); // inject incoming messages from pipes to it. extern nni_msgq *nni_sock_recvq(nni_sock *); -extern nni_duration nni_sock_linger(nni_sock *); -extern size_t nni_sock_rcvmaxsz(nni_sock *); -extern void nni_sock_reconntimes(nni_sock *, nni_duration *, nni_duration *); +extern size_t nni_sock_rcvmaxsz(nni_sock *); +extern void nni_sock_reconntimes(nni_sock *, nni_duration *, nni_duration *); #endif // CORE_SOCKET_H @@ -384,7 +384,7 @@ nng_setopt_size(nng_socket sid, int opt, size_t val) } int -nng_setopt_duration(nng_socket sid, int opt, uint64_t val) +nng_setopt_usec(nng_socket sid, int opt, uint64_t val) { return (nng_setopt(sid, opt, &val, sizeof(val))); } @@ -404,7 +404,7 @@ nng_getopt_size(nng_socket sid, int opt, size_t *valp) } int -nng_getopt_duration(nng_socket sid, int opt, uint64_t *valp) +nng_getopt_usec(nng_socket sid, int opt, uint64_t *valp) { size_t sz = sizeof(*valp); return (nng_getopt(sid, opt, valp, &sz)); @@ -88,13 +88,13 @@ NNG_DECL uint16_t nng_peer(nng_socket); // nng_setopt sets an option for a specific socket. NNG_DECL int nng_setopt(nng_socket, int, const void *, size_t); NNG_DECL int nng_setopt_int(nng_socket, int, int); -NNG_DECL int nng_setopt_duration(nng_socket, int, uint64_t); +NNG_DECL int nng_setopt_usec(nng_socket, int, uint64_t); NNG_DECL int nng_setopt_size(nng_socket, int, size_t); // nng_socket_getopt obtains the option for a socket. NNG_DECL int nng_getopt(nng_socket, int, void *, size_t *); NNG_DECL int nng_getopt_int(nng_socket, int, int *); -NNG_DECL int nng_getopt_duration(nng_socket, int, uint64_t *); +NNG_DECL int nng_getopt_usec(nng_socket, int, uint64_t *); NNG_DECL int nng_getopt_size(nng_socket, int, size_t *); // nng_notify_func is a user function that is executed upon certain diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c index 20fb07f8..fdf29fd9 100644 --- a/src/protocol/reqrep/req.c +++ b/src/protocol/reqrep/req.c @@ -273,7 +273,7 @@ nni_req_sock_setopt(void *arg, int opt, const void *buf, size_t sz) switch (opt) { case NNG_OPT_RESENDTIME: - rv = nni_setopt_duration(&req->retry, buf, sz); + rv = nni_setopt_usec(&req->retry, buf, sz); break; case NNG_OPT_RAW: rv = nni_setopt_int(&req->raw, buf, sz, 0, 1); @@ -298,7 +298,7 @@ nni_req_sock_getopt(void *arg, int opt, void *buf, size_t *szp) switch (opt) { case NNG_OPT_RESENDTIME: - rv = nni_getopt_duration(&req->retry, buf, szp); + rv = nni_getopt_usec(&req->retry, buf, szp); break; case NNG_OPT_RAW: rv = nni_getopt_int(&req->raw, buf, szp); diff --git a/src/protocol/survey/survey.c b/src/protocol/survey/survey.c index 45b06d67..cb90c13f 100644 --- a/src/protocol/survey/survey.c +++ b/src/protocol/survey/survey.c @@ -295,7 +295,7 @@ nni_surv_sock_setopt(void *arg, int opt, const void *buf, size_t sz) switch (opt) { case NNG_OPT_SURVEYTIME: - rv = nni_setopt_duration(&psock->survtime, buf, sz); + rv = nni_setopt_usec(&psock->survtime, buf, sz); break; case NNG_OPT_RAW: oldraw = psock->raw; @@ -324,7 +324,7 @@ nni_surv_sock_getopt(void *arg, int opt, void *buf, size_t *szp) switch (opt) { case NNG_OPT_SURVEYTIME: - rv = nni_getopt_duration(&psock->survtime, buf, szp); + rv = nni_getopt_usec(&psock->survtime, buf, szp); break; case NNG_OPT_RAW: rv = nni_getopt_int(&psock->raw, buf, szp); |
