From 45f455064b5704f3d5ed8ecf9f197a18fe72ee59 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 4 Apr 2018 12:37:34 -0700 Subject: fixes #331 replace NNG_OPT_RAW option with constructor This makes the raw mode something that is immutable, determined at socket construction. This is an enabling change for the separate context support coming soon. As a result, this is an API breaking change for users of the raw mode option (NNG_OPT_RAW). There aren't many of them out there. Cooked mode is entirely unaffected. There are changes to tests and documentation included. --- tests/device.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests/device.c') diff --git a/tests/device.c b/tests/device.c index c177a2e5..b1f97123 100644 --- a/tests/device.c +++ b/tests/device.c @@ -42,6 +42,12 @@ Main({ const char *addr1 = "inproc://dev1"; const char *addr2 = "inproc://dev2"; + Convey("We cannot create cooked mode device", { + nng_socket s1; + So(nng_pair1_open(&s1) == 0); + Reset({ nng_close(s1); }); + So(nng_device(s1, s1) == NNG_EINVAL); + }); Convey("We can create a PAIRv1 device", { nng_socket dev1; nng_socket dev2; @@ -51,11 +57,8 @@ Main({ nng_msg * msg; nng_thread * thr; - So(nng_pair1_open(&dev1) == 0); - So(nng_pair1_open(&dev2) == 0); - - So(nng_setopt_bool(dev1, NNG_OPT_RAW, true) == 0); - So(nng_setopt_bool(dev2, NNG_OPT_RAW, true) == 0); + So(nng_pair1_open_raw(&dev1) == 0); + So(nng_pair1_open_raw(&dev2) == 0); struct dev_data ddata; ddata.s1 = dev1; -- cgit v1.2.3-70-g09d2