From e70376044ba403ea936cb3d4b2d42d1fd1cde125 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 1 Jan 2025 15:01:07 -0800 Subject: demos: fix pubsub_forwarder to call nng_init --- demo/pubsub_forwarder/pubsub_forwarder.c | 13 +++++++++---- 1 file 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 #include -#include -#include #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 +} -- cgit v1.2.3-70-g09d2