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/sock.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'tests/sock.c') diff --git a/tests/sock.c b/tests/sock.c index a5b9bdc1..c4de6ad4 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -128,11 +128,6 @@ TestMain("Socket Operations", { So(nng_getopt_bool(s1, NNG_OPT_RAW, &raw) == 0); So(raw == false); - So(nng_setopt_bool(s1, NNG_OPT_RAW, true) == - 0); - So(nng_getopt_bool(s1, NNG_OPT_RAW, &raw) == - 0); - So(raw == true); }); Convey("URL option works", { @@ -255,16 +250,9 @@ TestMain("Socket Operations", { sz) == NNG_EINVAL); }); - Convey("Bogus raw fails", { - // Bool type is 1 byte. - So(nng_setopt_int(s1, NNG_OPT_RAW, 42) == - NNG_EBADTYPE); - So(nng_setopt_int(s1, NNG_OPT_RAW, -42) == - NNG_EBADTYPE); - So(nng_setopt_int(s1, NNG_OPT_RAW, 0) == - NNG_EBADTYPE); - So(nng_setopt(s1, NNG_OPT_RAW, "abcd", 4) == - NNG_EINVAL); + Convey("Cannot set raw", { + So(nng_setopt_bool(s1, NNG_OPT_RAW, true) == + NNG_EREADONLY); }); Convey("Unsupported options fail", { -- cgit v1.2.3-70-g09d2