diff options
Diffstat (limited to 'src/core/device.c')
| -rw-r--r-- | src/core/device.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core/device.c b/src/core/device.c index 0eaec30e..6def9f64 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -105,6 +105,8 @@ nni_device_init(nni_device_data **dp, nni_sock *s1, nni_sock *s2) nni_device_data *dd; int npath = 2; int i; + bool raw; + size_t rsz; // Specifying either of these as null turns the device into // a loopback reflector. @@ -123,6 +125,21 @@ nni_device_init(nni_device_data **dp, nni_sock *s1, nni_sock *s2) return (NNG_EINVAL); } + raw = false; + rsz = sizeof(raw); + if (((nni_sock_getopt(s1, NNG_OPT_RAW, &raw, &rsz, NNI_TYPE_BOOL) != + 0)) || + (!raw)) { + return (NNG_EINVAL); + } + + rsz = sizeof(raw); + if (((nni_sock_getopt(s2, NNG_OPT_RAW, &raw, &rsz, NNI_TYPE_BOOL) != + 0)) || + (!raw)) { + return (NNG_EINVAL); + } + // Note we assume that since they peers, we only need to look // at the receive flags -- the other side is assumed to be able // to send. @@ -201,7 +218,7 @@ nni_device(nni_sock *s1, nni_sock *s2) if ((rv = nni_aio_init(&aio, NULL, NULL)) != 0) { return (rv); } - if (nni_device_init(&dd, s1, s2) != 0) { + if ((rv = nni_device_init(&dd, s1, s2)) != 0) { nni_aio_fini(aio); return (rv); } |
