diff options
| author | Nathan Kent <nkent2@cs.rochester.edu> | 2019-04-28 02:37:29 -0400 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-05-19 11:59:57 -0700 |
| commit | d83d86a140c44cca5f1867479ea7e77a0550e299 (patch) | |
| tree | 79e62882025039b42ae297b0a12bf19f9355127b /src/protocol/pubsub0/pub.c | |
| parent | ff78f0074248b6920bad1e9ec5fa455cc989545b (diff) | |
| download | nng-d83d86a140c44cca5f1867479ea7e77a0550e299.tar.gz nng-d83d86a140c44cca5f1867479ea7e77a0550e299.tar.bz2 nng-d83d86a140c44cca5f1867479ea7e77a0550e299.zip | |
fixes #923 #935 RECVBUF/SENDBUF has variable type
Diffstat (limited to 'src/protocol/pubsub0/pub.c')
| -rw-r--r-- | src/protocol/pubsub0/pub.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/protocol/pubsub0/pub.c b/src/protocol/pubsub0/pub.c index c4a164e7..be550439 100644 --- a/src/protocol/pubsub0/pub.c +++ b/src/protocol/pubsub0/pub.c @@ -314,22 +314,22 @@ pub0_sock_set_sendbuf(void *arg, const void *buf, size_t sz, nni_type t) { pub0_sock *sock = arg; pub0_pipe *p; - size_t val; + int val; int rv; - if ((rv = nni_copyin_size(&val, buf, sz, 1, 8192, t)) != 0) { + if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) { return (rv); } nni_mtx_lock(&sock->mtx); - sock->sendbuf = val; + sock->sendbuf = (size_t) val; NNI_LIST_FOREACH (&sock->pipes, p) { // If we fail part way thru (should only be ENOMEM), we // stop short. The others would likely fail for ENOMEM as // well anyway. There is a weird effect here where the // buffers may have been set for *some* of the pipes, but // we have no way to correct, or even report, partial failure. - if ((rv = nni_lmq_resize(&p->sendq, val)) != 0) { + if ((rv = nni_lmq_resize(&p->sendq, (size_t) val)) != 0) { break; } } @@ -341,11 +341,11 @@ static int pub0_sock_get_sendbuf(void *arg, void *buf, size_t *szp, nni_type t) { pub0_sock *sock = arg; - size_t val; + int val; nni_mtx_lock(&sock->mtx); - val = sock->sendbuf; + val = (int) sock->sendbuf; nni_mtx_unlock(&sock->mtx); - return (nni_copyout_size(val, buf, szp, t)); + return (nni_copyout_int(val, buf, szp, t)); } static nni_proto_pipe_ops pub0_pipe_ops = { |
