diff options
| author | Edward Rudd <urkle@outoforder.cc> | 2021-11-27 20:55:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-27 17:55:35 -0800 |
| commit | 6407267ad710ecf1bd3430207e42d3c581eaaf45 (patch) | |
| tree | e74b9b5809f1505f3cf8742955fb562047e899d7 /demo | |
| parent | 1ab464628bb4518f5868df11d033368caaa0a106 (diff) | |
| download | nng-6407267ad710ecf1bd3430207e42d3c581eaaf45.tar.gz nng-6407267ad710ecf1bd3430207e42d3c581eaaf45.tar.bz2 nng-6407267ad710ecf1bd3430207e42d3c581eaaf45.zip | |
update demos to not use deprecated functions (#1531)
Diffstat (limited to 'demo')
| -rw-r--r-- | demo/async/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | demo/http_client/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | demo/raw/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | demo/reqrep/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | demo/reqrep/reqrep.c | 32 | ||||
| -rw-r--r-- | demo/rest/CMakeLists.txt | 5 |
6 files changed, 35 insertions, 23 deletions
diff --git a/demo/async/CMakeLists.txt b/demo/async/CMakeLists.txt index 614bcfc3..ef9311bf 100644 --- a/demo/async/CMakeLists.txt +++ b/demo/async/CMakeLists.txt @@ -7,7 +7,7 @@ # file was obtained (LICENSE.txt). A copy of the license may also be # found online at https://opensource.org/licenses/MIT. -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 2.8.12) project(nng-asyncdemo) @@ -16,9 +16,12 @@ set(PARALLEL 128 CACHE STRING "Parallelism (min 4, max 1000)") # Call this from your own project's makefile. find_package(nng CONFIG REQUIRED) +find_package(Threads) + add_executable(server server.c) target_link_libraries(server nng::nng) -target_compile_definitions(server PRIVATE -DPARALLEL=${PARALLEL}) +target_compile_definitions(server PRIVATE NNG_ELIDE_DEPRECATED PARALLEL=${PARALLEL}) add_executable(client client.c) target_link_libraries(client nng::nng) +target_compile_definitions(client PRIVATE NNG_ELIDE_DEPRECATED) diff --git a/demo/http_client/CMakeLists.txt b/demo/http_client/CMakeLists.txt index 3fe126f9..8f4b62f4 100644 --- a/demo/http_client/CMakeLists.txt +++ b/demo/http_client/CMakeLists.txt @@ -7,12 +7,15 @@ # file was obtained (LICENSE.txt). A copy of the license may also be # found online at https://opensource.org/licenses/MIT. -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 2.8.12) project(http_client) # Call this from your own project's makefile. find_package(nng CONFIG REQUIRED) +find_package(Threads) + add_executable(http_client http_client.c) target_link_libraries(http_client nng::nng) +target_compile_definitions(http_client PRIVATE NNG_ELIDE_DEPRECATED) diff --git a/demo/raw/CMakeLists.txt b/demo/raw/CMakeLists.txt index 15e481d5..2df8d394 100644 --- a/demo/raw/CMakeLists.txt +++ b/demo/raw/CMakeLists.txt @@ -7,7 +7,7 @@ # file was obtained (LICENSE.txt). A copy of the license may also be # found online at https://opensource.org/licenses/MIT. -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 2.8.12) project(raw) @@ -15,6 +15,8 @@ set(PARALLEL 128 CACHE STRING "Parallelism (min 4, max 1000)") find_package(nng CONFIG REQUIRED) +find_package(Threads) + add_executable(raw raw.c) target_link_libraries(raw nng::nng) -target_compile_definitions(raw PRIVATE -DPARALLEL=${PARALLEL}) +target_compile_definitions(raw PRIVATE NNG_ELIDE_DEPRECATED PARALLEL=${PARALLEL}) diff --git a/demo/reqrep/CMakeLists.txt b/demo/reqrep/CMakeLists.txt index c7a258b0..09234646 100644 --- a/demo/reqrep/CMakeLists.txt +++ b/demo/reqrep/CMakeLists.txt @@ -7,7 +7,7 @@ # file was obtained (LICENSE.txt). A copy of the license may also be # found online at https://opensource.org/licenses/MIT. -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 2.8.12) project(reqrep) @@ -20,3 +20,4 @@ find_package(Threads) add_executable(reqrep reqrep.c) target_link_libraries(reqrep nng::nng) +target_compile_definitions(reqrep PRIVATE NNG_ELIDE_DEPRECATED) diff --git a/demo/reqrep/reqrep.c b/demo/reqrep/reqrep.c index 3fccf688..62ff29a4 100644 --- a/demo/reqrep/reqrep.c +++ b/demo/reqrep/reqrep.c @@ -88,15 +88,15 @@ server(const char *url) if (strncmp(url, "zt://", 5) == 0) { printf("ZeroTier transport will store its keys in current working directory.\n"); printf("The server and client instances must run in separate directories.\n"); - nng_listener_setopt_string(listener, NNG_OPT_ZT_HOME, "."); - nng_listener_setopt_ms(listener, NNG_OPT_RECONNMINT, 1); - nng_listener_setopt_ms(listener, NNG_OPT_RECONNMAXT, 1000); - nng_setopt_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); - nng_setopt_ms(sock, NNG_OPT_RECVMAXSZ, 0); - nng_listener_setopt_ms(listener, NNG_OPT_ZT_PING_TIME, 10000); - nng_listener_setopt_ms(listener, NNG_OPT_ZT_CONN_TIME, 1000); + nng_listener_set_string(listener, NNG_OPT_ZT_HOME, "."); + nng_listener_set_ms(listener, NNG_OPT_RECONNMINT, 1); + nng_listener_set_ms(listener, NNG_OPT_RECONNMAXT, 1000); + nng_socket_set_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); + nng_socket_set_ms(sock, NNG_OPT_RECVMAXSZ, 0); + nng_listener_set_ms(listener, NNG_OPT_ZT_PING_TIME, 10000); + nng_listener_set_ms(listener, NNG_OPT_ZT_CONN_TIME, 1000); } else { - nng_setopt_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); + nng_socket_set_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); } nng_listener_start(listener, 0); @@ -158,15 +158,15 @@ client(const char *url) if (strncmp(url, "zt://", 5) == 0) { printf("ZeroTier transport will store its keys in current working directory\n"); printf("The server and client instances must run in separate directories.\n"); - nng_dialer_setopt_string(dialer, NNG_OPT_ZT_HOME, "."); - nng_dialer_setopt_ms(dialer, NNG_OPT_RECONNMINT, 1); - nng_dialer_setopt_ms(dialer, NNG_OPT_RECONNMAXT, 1000); - nng_setopt_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); - nng_setopt_ms(sock, NNG_OPT_RECVMAXSZ, 0); - nng_dialer_setopt_ms(dialer, NNG_OPT_ZT_PING_TIME, 10000); - nng_dialer_setopt_ms(dialer, NNG_OPT_ZT_CONN_TIME, 1000); + nng_dialer_set_string(dialer, NNG_OPT_ZT_HOME, "."); + nng_dialer_set_ms(dialer, NNG_OPT_RECONNMINT, 1); + nng_dialer_set_ms(dialer, NNG_OPT_RECONNMAXT, 1000); + nng_socket_set_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); + nng_socket_set_ms(sock, NNG_OPT_RECVMAXSZ, 0); + nng_dialer_set_ms(dialer, NNG_OPT_ZT_PING_TIME, 10000); + nng_dialer_set_ms(dialer, NNG_OPT_ZT_CONN_TIME, 1000); } else { - nng_setopt_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); + nng_socket_set_ms(sock, NNG_OPT_REQ_RESENDTIME, 2000); } nng_dialer_start(dialer, NNG_FLAG_NONBLOCK); diff --git a/demo/rest/CMakeLists.txt b/demo/rest/CMakeLists.txt index 5466e3c7..d5dd4fe4 100644 --- a/demo/rest/CMakeLists.txt +++ b/demo/rest/CMakeLists.txt @@ -7,11 +7,14 @@ # file was obtained (LICENSE.txt). A copy of the license may also be # found online at https://opensource.org/licenses/MIT. -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 2.8.12) project(rest) find_package(nng CONFIG REQUIRED) +find_package(Threads) + add_executable(rest-server server.c) target_link_libraries(rest-server nng::nng) +target_compile_definitions(rest-server PRIVATE NNG_ELIDE_DEPRECATED) |
