aboutsummaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/CMakeLists.txt20
-rw-r--r--src/protocol/bus0/CMakeLists.txt9
-rw-r--r--src/protocol/bus0/bug1247_test.c39
-rw-r--r--src/protocol/pair0/CMakeLists.txt5
-rw-r--r--src/protocol/pair1/CMakeLists.txt4
-rw-r--r--src/protocol/pipeline0/CMakeLists.txt6
-rw-r--r--src/protocol/pubsub0/CMakeLists.txt6
-rw-r--r--src/protocol/reqrep0/CMakeLists.txt6
-rw-r--r--src/protocol/survey0/CMakeLists.txt6
9 files changed, 72 insertions, 29 deletions
diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt
new file mode 100644
index 00000000..fd480523
--- /dev/null
+++ b/src/protocol/CMakeLists.txt
@@ -0,0 +1,20 @@
+#
+# Copyright 2020 Staysail Systems, Inc. <info@staystail.tech>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+#
+
+# Protocols.
+nng_directory(protocol)
+
+add_subdirectory(bus0)
+add_subdirectory(pair0)
+add_subdirectory(pair1)
+add_subdirectory(pipeline0)
+add_subdirectory(pubsub0)
+add_subdirectory(reqrep0)
+add_subdirectory(survey0)
+
diff --git a/src/protocol/bus0/CMakeLists.txt b/src/protocol/bus0/CMakeLists.txt
index 1115e2ec..01c0b05b 100644
--- a/src/protocol/bus0/CMakeLists.txt
+++ b/src/protocol/bus0/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
# Copyright 2018 Capitar IT Group BV <info@capitar.com>
#
# This software is supplied under the terms of the MIT License, a
@@ -9,9 +9,10 @@
#
# Bus protocol
-option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_BUS0)
+nng_directory(bus0)
nng_sources_if(NNG_PROTO_BUS0 bus.c)
nng_headers_if(NNG_PROTO_BUS0 nng/protocol/bus0/bus.h)
-nng_defines_if(NNG_PROTO_BUS0 NNG_HAVE_BUS0) \ No newline at end of file
+nng_defines_if(NNG_PROTO_BUS0 NNG_HAVE_BUS0)
+
+nng_test(bug1247_test) \ No newline at end of file
diff --git a/src/protocol/bus0/bug1247_test.c b/src/protocol/bus0/bug1247_test.c
new file mode 100644
index 00000000..6f418f53
--- /dev/null
+++ b/src/protocol/bus0/bug1247_test.c
@@ -0,0 +1,39 @@
+//
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#include <string.h>
+
+#include <nng/nng.h>
+#include <nng/protocol/bus0/bus.h>
+
+#include "acutest.h"
+#include "testutil.h"
+
+void
+test_bug1247(void)
+{
+ nng_socket bus1, bus2;
+ char addr[64];
+
+ testutil_scratch_addr("tcp", sizeof(addr), addr);
+
+ TEST_NNG_PASS(nng_bus0_open(&bus1));
+ TEST_NNG_PASS(nng_bus0_open(&bus2));
+
+ TEST_NNG_PASS(nng_listen(bus1, addr, NULL, 0));
+ TEST_NNG_FAIL(nng_listen(bus2, addr, NULL, 0), NNG_EADDRINUSE);
+
+ TEST_NNG_PASS(nng_close(bus2));
+ TEST_NNG_PASS(nng_close(bus1));
+}
+
+TEST_LIST = {
+ { "bug1247", test_bug1247 },
+ { NULL, NULL },
+};
diff --git a/src/protocol/pair0/CMakeLists.txt b/src/protocol/pair0/CMakeLists.txt
index c3da1b07..b12583ab 100644
--- a/src/protocol/pair0/CMakeLists.txt
+++ b/src/protocol/pair0/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
# Copyright 2018 Capitar IT Group BV <info@capitar.com>
#
# This software is supplied under the terms of the MIT License, a
@@ -9,8 +9,7 @@
#
# PAIRv0 protocol
-option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_PAIR0)
+nng_directory(pair0)
nng_sources_if(NNG_PROTO_PAIR0 pair.c)
nng_headers_if(NNG_PROTO_PAIR0 nng/protocol/pair0/pair.h)
diff --git a/src/protocol/pair1/CMakeLists.txt b/src/protocol/pair1/CMakeLists.txt
index f586fabe..12e12607 100644
--- a/src/protocol/pair1/CMakeLists.txt
+++ b/src/protocol/pair1/CMakeLists.txt
@@ -9,12 +9,12 @@
#
# PAIRv1 protocol
-option (NNG_PROTO_PAIR1 "Enable PAIRv1 protocol." ON)
-mark_as_advanced(NNG_PROTO_PAIR1)
+nng_directory(pair1)
# XXX: break pair1_poly into an ifdef.
nng_sources_if(NNG_PROTO_PAIR1 pair.c pair1_poly.c)
nng_headers_if(NNG_PROTO_PAIR1 nng/protocol/pair1/pair.h)
nng_defines_if(NNG_PROTO_PAIR1 NNG_HAVE_PAIR1)
+
nng_test(pair1_test)
nng_test(pair1_poly_test) \ No newline at end of file
diff --git a/src/protocol/pipeline0/CMakeLists.txt b/src/protocol/pipeline0/CMakeLists.txt
index 0e211cf5..4f591450 100644
--- a/src/protocol/pipeline0/CMakeLists.txt
+++ b/src/protocol/pipeline0/CMakeLists.txt
@@ -9,11 +9,7 @@
#
# Pipeline protocol
-option (NNG_PROTO_PUSH0 "Enable PUSHv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_PUSH0)
-
-option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_PULL0)
+nng_directory(pipeline0)
nng_sources_if(NNG_PROTO_PUSH0 push.c)
nng_headers_if(NNG_PROTO_PUSH0 nng/protocol/pipeline0/push.h)
diff --git a/src/protocol/pubsub0/CMakeLists.txt b/src/protocol/pubsub0/CMakeLists.txt
index 8687de4e..160b7462 100644
--- a/src/protocol/pubsub0/CMakeLists.txt
+++ b/src/protocol/pubsub0/CMakeLists.txt
@@ -9,11 +9,7 @@
#
# Pub/Sub protocol
-option (NNG_PROTO_PUB0 "Enable PUBv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_PUB0)
-
-option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_SUB0)
+nng_directory(pubsub0)
nng_sources_if(NNG_PROTO_PUB0 pub.c)
nng_headers_if(NNG_PROTO_PUB0 nng/protocol/pubsub0/pub.h)
diff --git a/src/protocol/reqrep0/CMakeLists.txt b/src/protocol/reqrep0/CMakeLists.txt
index 46eb7abf..a3cecfd0 100644
--- a/src/protocol/reqrep0/CMakeLists.txt
+++ b/src/protocol/reqrep0/CMakeLists.txt
@@ -9,11 +9,7 @@
#
# Req/Rep protocol
-option(NNG_PROTO_REQ0 "Enable REQv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_REQ0)
-
-option(NNG_PROTO_REP0 "Enable REPv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_REP0)
+nng_directory(reqrep0)
nng_sources_if(NNG_PROTO_REQ0 req.c xreq.c)
nng_headers_if(NNG_PROTO_REQ0 nng/protocol/reqrep0/req.h)
diff --git a/src/protocol/survey0/CMakeLists.txt b/src/protocol/survey0/CMakeLists.txt
index 6b3c8277..b5daca41 100644
--- a/src/protocol/survey0/CMakeLists.txt
+++ b/src/protocol/survey0/CMakeLists.txt
@@ -9,11 +9,7 @@
#
# Surveyor/Respondent protocol
-option (NNG_PROTO_RESPONDENT0 "Enable RESPONDENTv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_RESPONDENT0)
-
-option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON)
-mark_as_advanced(NNG_PROTO_SURVEYOR0)
+nng_directory(survey0)
nng_sources_if(NNG_PROTO_SURVEYOR0 survey.c xsurvey.c)
nng_headers_if(NNG_PROTO_SURVEYOR0 nng/protocol/survey0/survey.h)