aboutsummaryrefslogtreecommitdiff
path: root/demo/async/server.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-01 15:38:19 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-01 15:40:54 -0800
commit46117f86d47da376b37c6fb4d72ee202de599c9b (patch)
tree0eae4d42b2fce56163cd5fa1c361038567c46371 /demo/async/server.c
parent6cd521d5e68318ab3a93cb0e9cd4ee793576a643 (diff)
downloadnng-46117f86d47da376b37c6fb4d72ee202de599c9b.tar.gz
nng-46117f86d47da376b37c6fb4d72ee202de599c9b.tar.bz2
nng-46117f86d47da376b37c6fb4d72ee202de599c9b.zip
demos: raw and async demos should use nng_init
Diffstat (limited to 'demo/async/server.c')
-rw-r--r--demo/async/server.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/demo/async/server.c b/demo/async/server.c
index 528926e6..b8a87a7e 100644
--- a/demo/async/server.c
+++ b/demo/async/server.c
@@ -1,4 +1,4 @@
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitoar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -33,8 +33,6 @@
#include <time.h>
#include <nng/nng.h>
-#include <nng/protocol/reqrep0/rep.h>
-#include <nng/supplemental/util/platform.h>
// Parallel is the maximum number of outstanding requests we can handle.
// This is *NOT* the number of threads in use, but instead represents
@@ -68,7 +66,7 @@ void
server_cb(void *arg)
{
struct work *work = arg;
- nng_msg * msg;
+ nng_msg *msg;
int rv;
uint32_t when;
@@ -141,6 +139,11 @@ server(const char *url)
int rv;
int i;
+ rv = nng_init(NULL);
+ if (rv != 0) {
+ fatal("nng_init", rv);
+ }
+
/* Create the socket. */
rv = nng_rep0_open(&sock);
if (rv != 0) {