aboutsummaryrefslogtreecommitdiff
path: root/demo/pubsub_forwarder
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-01 15:01:07 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-01 15:01:07 -0800
commite70376044ba403ea936cb3d4b2d42d1fd1cde125 (patch)
treeea090930344b6c7afc23b18126df05eda0ae85da /demo/pubsub_forwarder
parent8adeef97b51deedb7c482f6956a7a15584bd5678 (diff)
downloadnng-e70376044ba403ea936cb3d4b2d42d1fd1cde125.tar.gz
nng-e70376044ba403ea936cb3d4b2d42d1fd1cde125.tar.bz2
nng-e70376044ba403ea936cb3d4b2d42d1fd1cde125.zip
demos: fix pubsub_forwarder to call nng_init
Diffstat (limited to 'demo/pubsub_forwarder')
-rw-r--r--demo/pubsub_forwarder/pubsub_forwarder.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/demo/pubsub_forwarder/pubsub_forwarder.c b/demo/pubsub_forwarder/pubsub_forwarder.c
index e79c04b0..8da3a3aa 100644
--- a/demo/pubsub_forwarder/pubsub_forwarder.c
+++ b/demo/pubsub_forwarder/pubsub_forwarder.c
@@ -28,8 +28,6 @@
#include <stdlib.h>
#include <nng/nng.h>
-#include <nng/protocol/pubsub0/pub.h>
-#include <nng/protocol/pubsub0/sub.h>
#define PROXY_FRONT_URL "tcp://localhost:3327"
#define PROXY_BACK_URL "tcp://localhost:3328"
@@ -47,16 +45,22 @@ panic_on_error(int should_panic, const char *format, ...)
}
int
-main()
+main(int argc, char **argv)
{
nng_socket sock_front_end = NNG_SOCKET_INITIALIZER;
nng_socket sock_back_end = NNG_SOCKET_INITIALIZER;
int ret = 0;
+ (void) argc;
+ (void) argv;
+
//
// First we need some nng sockets. Not to be confused with network
// sockets
//
+ ret = nng_init(NULL);
+ panic_on_error(ret, "Failed to init library\n");
+
ret = nng_sub0_open_raw(&sock_front_end);
panic_on_error(ret, "Failed to open front end socket\n");
@@ -92,5 +96,6 @@ main()
ret, "nng_device returned %d: %s\n", ret, nng_strerror(ret));
printf("done");
+ nng_fini();
return 0;
-} \ No newline at end of file
+}