Skip to content

add runtime api selection + void* data for listeners' callbacks #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7c2fed5
compiling api enforcement
Xavrax Jan 20, 2025
f8fc91f
some cmake changes
Xavrax Jan 21, 2025
90ac3d3
more works
Xavrax Jan 21, 2025
5d17ba8
almost all callbacks defines are runtime now
Xavrax Jan 22, 2025
296fa92
it (almost) works!!!!!
Xavrax Jan 22, 2025
a5f078a
works
Xavrax Jan 23, 2025
d0c474c
less waiting time
Xavrax Jan 23, 2025
0767e3b
windows callbacks
Xavrax Jan 23, 2025
dceb9fe
openssl windows
Xavrax Jan 23, 2025
ca7e13a
better file name
Xavrax Jan 23, 2025
d43401d
stdbool
Xavrax Jan 23, 2025
0421757
proper defaults in CMAKE
Xavrax Jan 23, 2025
0c6798f
todos
Xavrax Jan 23, 2025
7e2df3b
fixes
Xavrax Jan 23, 2025
ae3f409
some docks
Xavrax Jan 23, 2025
0f50d01
fix docs
Xavrax Jan 23, 2025
fac6fb6
remove leaked keys
Xavrax Jan 23, 2025
6cd8119
openssl init
Xavrax Jan 23, 2025
d08c2a8
mbedtls
Xavrax Jan 23, 2025
4730575
freertos
Xavrax Jan 23, 2025
270eae9
fail on await
Xavrax Jan 28, 2025
9938039
this is sus
Xavrax Jan 28, 2025
6f3c665
okay it have to work
Xavrax Jan 28, 2025
0795fae
Fix callback api not working on Windows when built by cmake.
KGronek-Pubnub Feb 12, 2025
63fbd33
Merge branch 'master' into feat/runtime-api-enforcement
Xavrax Feb 19, 2025
b206cfc
fix wrong blocking
Xavrax Jan 29, 2025
499193b
fix removal of callbacks
Xavrax Feb 27, 2025
7a4561b
add guards
Xavrax Mar 28, 2025
f5faace
fix cmake to not provide breaking changes
Xavrax Mar 28, 2025
8fb7c39
add enforcement to makefiles but not working :c
Xavrax Mar 28, 2025
1b4a877
fixes for cmake file
Xavrax Mar 28, 2025
a763ec3
add them as all in mks
Xavrax Apr 2, 2025
befc777
fix library in make
Xavrax Apr 2, 2025
dfc8515
Fixes to build with makefiles.
KGronek-Pubnub Apr 2, 2025
3d5d948
please work
Xavrax Apr 2, 2025
596ca9d
Fix to makefiles
KGronek-Pubnub Apr 2, 2025
b22616c
add error for openssl debugging
Xavrax Apr 2, 2025
81a27ea
Merge branch 'master' into feat/runtime-api-enforcement
Xavrax Apr 2, 2025
b51ed72
introduce `void*` parameter for user data in listeners (#207)
Xavrax Apr 2, 2025
e230f2c
PubNub SDK v5.0.0 release.
pubnub-release-bot Apr 3, 2025
27ca218
breaking change
Xavrax Apr 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 109 additions & 29 deletions CMakeLists.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to compare with make/common/source_files.mk, make/posix_source_files.mk, and windows_source_files.mk? I've noticed that some source files are missing and some placed for wrong environment.

Here is some:
${CMAKE_CURRENT_LIST_DIR}/lib/pubnub_dns_codec.c and ${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_adns_sockets.c - this one used only in Callback API (at least according to the code)
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_alloc_std.c - present in both if and else branches. Should we just move it to the core files list declaration?
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_memory_block.c - for some reason specified only for Callback API but it is general API (at least according to the code)
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_version_posix.c - can't be added as is to OS_SOURCEFILES because there exists another version file for WITH_CPP: ${CMAKE_CURRENT_LIST_DIR}/cpp/pubnub_version_posix.cpp. Similar situation with version file for Windows which also depends from WITH_CPP

${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_sockets.c - I've noticed that we don't have this in cmake settings for non-openssl build (at least it was in original make files)
${CMAKE_CURRENT_LIST_DIR}/posix/pbpal_posix_blocking_io.c - is missing for non-openssl POSIX build

${CMAKE_CURRENT_LIST_DIR}/core/pubnub_ssl.c, ${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_connect_openssl.c, ${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_openssl.c, ${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_openssl_blocking_io.c - looks like this one also missing for openssl build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ues sure.
I found that there are few differences between makefiles and cmake - probably I will need some help with that.

Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ num_option(USE_REVOKE_TOKEN_API "Use revoke token API [OPENSSL ONLY]" OFF)
num_option(USE_GRANT_TOKEN_API "Use grant token API [OPENSSL ONLY]" OFF)
num_option(USE_FETCH_HISTORY "Use fetch history" ON)
num_option(USE_CRYPTO_API "Use crypto API [OPENSSL ONLY]" OFF)
num_option(USE_CALLBACK_API "Use callback API [CALLBACK=ON SYNC=OFF]" ${DEFAULT_USE_CALLBACK_API})
num_option(USE_NTF_RUNTIME_SELECTION "Use runtime NTF API selection" OFF)
num_option(USE_CALLBACK_API "Use callback API" ${DEFAULT_USE_CALLBACK_API})
num_option(USE_IPV6 "Use IPv6" ON)
num_option(USE_SET_DNS_SERVERS "Use set DNS servers [CALLBACK=ON]" ${DEFAULT_USE_CALLBACK_API})
num_option(USE_EXTERN_API "Use extern C API [WITH_CPP=ON]" ON)
num_option(USE_LEGACY_CRYPTO_RANDOM_IV "Use random IV for legacy crypto module [OpenSSL only]" ON)
num_option(USE_LOG_CALLBACK "Use possibility to replace default logging function with user provided callback" OFF)
log_option(COMPILE_COMMANDS "Generate compile_commands.json" OFF)
log_set(OPENSSL_ROOT_DIR "" "OpenSSL root directory (leave empty for find_package() defaults)[OPENSSL=ON needed]")
log_set(CUSTOM_OPENSSL_LIB_DIR "lib" "OpenSSL lib directory relative to OPENSSL_ROOT_DIR [used only if find_package() failed]")
log_set(CUSTOM_OPENSSL_INCLUDE_DIR "include" "OpenSSL include directory relative to OPENSSL_ROOT_DIR [used only if find_package() failed]")
Expand All @@ -97,6 +99,15 @@ if (${OPENSSL} AND ${MBEDTLS})
message(FATAL_ERROR "You can't use both OpenSSL and mbedTLS at the same time!")
endif ()

if (${USE_NTF_RUNTIME_SELECTION} AND NOT ${USE_CALLBACK_API})
message(FATAL_ERROR "You must enable callback API to use runtime NTF API selection!")
endif ()

if(${COMPILE_COMMANDS})
message(STATUS "Generating compile_commands.json")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
endif()

# Flags configuration

set(FLAGS "\
Expand Down Expand Up @@ -143,7 +154,13 @@ if (${USE_CALLBACK_API})
${FLAGS} \
-D PUBNUB_SET_DNS_SERVERS=${USE_SET_DNS_SERVERS} \
-D PUBNUB_USE_IPV6=${USE_IPV6} \
-D PUBNUB_CALLBACK_API")
-D PUBNUB_CALLBACK_API=${USE_CALLBACK_API}")
endif ()

if (${USE_SYNC_API})
set(FLAGS "\
${FLAGS} \
-D PUBNUB_USE_SYNC_API=${USE_SYNC_API}")
endif ()

if (${ASAN})
Expand Down Expand Up @@ -195,30 +212,25 @@ set(CORE_SOURCEFILES
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_helper.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_generate_uuid_v3_md5.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_free_with_timeout_std.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_alloc_std.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_memory_block.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_url_encode.c)

set(LIB_SOURCEFILES
${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_handle_socket_error.c
${CMAKE_CURRENT_LIST_DIR}/lib/base64/pbbase64.c
${CMAKE_CURRENT_LIST_DIR}/lib/pb_strnlen_s.c
${CMAKE_CURRENT_LIST_DIR}/lib/pb_strncasecmp.c
${CMAKE_CURRENT_LIST_DIR}/lib/pubnub_dns_codec.c)
${CMAKE_CURRENT_LIST_DIR}/lib/pb_strncasecmp.c)

if (UNIX OR WIN32 OR WIN64 OR MSVC)
set(CORE_SOURCEFILES
${CORE_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_alloc_std.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_generate_uuid.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_assert_std.c)

set(LIB_SOURCEFILES
${LIB_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_adns_sockets.c
${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_resolv_and_connect_sockets.c)
else ()
set(CORE_SOURCEFILES
${CORE_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_alloc_std.c)
endif ()

if (NOT ${OPENSSL})
Expand All @@ -233,11 +245,13 @@ if (UNIX)
set(LDLIBS "-lpthread ${LDLIBS}")
set(OS_SOURCEFILES
${CMAKE_CURRENT_LIST_DIR}/posix/posix_socket_blocking_io.c
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_version_posix.c
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_generate_uuid_posix.c
${CMAKE_CURRENT_LIST_DIR}/posix/msstopwatch_monotonic_clock.c
${CMAKE_CURRENT_LIST_DIR}/posix/pbtimespec_elapsed_ms.c
${CMAKE_CURRENT_LIST_DIR}/posix/pb_sleep_ms.c)
if (NOT ${WITH_CPP})
set(OS_SOURCEFILES ${OS_SOURCEFILES} ${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_version_posix.c)
endif ()

if (APPLE)
set(OS_SOURCEFILES ${OS_SOURCEFILES} ${CMAKE_CURRENT_LIST_DIR}/posix/monotonic_clock_get_time_darwin.c)
Expand All @@ -251,12 +265,15 @@ elseif (WIN32 OR WIN64 OR MSVC)
set(OS_SOURCEFILES
${CMAKE_CURRENT_LIST_DIR}/windows/windows_socket_blocking_io.c
${CMAKE_CURRENT_LIST_DIR}/windows/pbtimespec_elapsed_ms.c
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_version_windows.c
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_generate_uuid_windows.c
${CMAKE_CURRENT_LIST_DIR}/windows/pbpal_windows_blocking_io.c
${CMAKE_CURRENT_LIST_DIR}/windows/msstopwatch_windows.c
${CMAKE_CURRENT_LIST_DIR}/windows/pb_sleep_ms.c
${CMAKE_CURRENT_LIST_DIR}/windows/pbauto_heartbeat_init_windows.c)

if (NOT ${WITH_CPP})
set(OS_SOURCEFILES ${OS_SOURCEFILES} ${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_version_windows.c)
endif ()
else ()
message(STATUS "Using FreeRTOS setup")

Expand All @@ -276,11 +293,8 @@ endif ()
set(INTF_SOURCEFILES)

if (${USE_CALLBACK_API})
message(STATUS "Using callback API")

set(CORE_SOURCEFILES
${CORE_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_memory_block.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_dns_servers.c)

set(INTF_SOURCEFILES
Expand All @@ -293,31 +307,74 @@ if (${USE_CALLBACK_API})
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_callback_subscribe_loop.c
${CMAKE_CURRENT_LIST_DIR}/core/pbpal_ntf_callback_admin.c
${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_adns_sockets.c
${CMAKE_CURRENT_LIST_DIR}/lib/pubnub_dns_codec.c
${INTF_SOURCEFILES})

if (UNIX)
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_dns_system_servers.c
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_ntf_callback_posix.c
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_get_native_socket.c)
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_dns_system_servers.c)
if (${OPENSSL})
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/openssl/pubnub_get_native_socket.c
${CMAKE_CURRENT_LIST_DIR}/openssl/pubnub_ntf_callback_posix.c)
else ()
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_get_native_socket.c
${CMAKE_CURRENT_LIST_DIR}/posix/pubnub_ntf_callback_posix.c)
endif ()

elseif (WIN32 OR WIN64 OR MSVC)
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_ntf_callback_windows.c
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_dns_system_servers.c
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_get_native_socket.c)
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_dns_system_servers.c)
if (${OPENSSL})
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/openssl/pubnub_get_native_socket.c
${CMAKE_CURRENT_LIST_DIR}/openssl/pubnub_ntf_callback_windows.c)
else ()
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_get_native_socket.c
${CMAKE_CURRENT_LIST_DIR}/windows/pubnub_ntf_callback_windows.c)
endif ()
endif ()
else ()
message(STATUS "Using sync API")

if (UNIX OR WIN32 OR WIN64 OR MSVC)
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/lib/sockets/pbpal_adns_sockets.c)
endif ()
endif ()

if (${USE_NTF_RUNTIME_SELECTION} OR NOT ${USE_CALLBACK_API})
set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_ntf_sync.c
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_sync_subscribe_loop.c
${CMAKE_CURRENT_LIST_DIR}/core/srand_from_pubnub_time.c)
endif ()

if (${USE_NTF_RUNTIME_SELECTION})
message(STATUS "Using runtime API selection")

set(CMAKE_C_FLAGS "\
${CMAKE_C_FLAGS} \
-D PUBNUB_NTF_RUNTIME_SELECTION")

set(INTF_SOURCEFILES
${INTF_SOURCEFILES}
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_ntf_enforcement.c)

elseif (${USE_CALLBACK_API})
message(STATUS "Using callback API")
else ()
message(STATUS "Using sync API")
endif ()

set(FEATURE_SOURCEFILES)

if (${USE_PROXY})
Expand Down Expand Up @@ -495,6 +552,7 @@ if (${OPENSSL})
${LIB_SOURCEFILES})

set(FEATURE_SOURCEFILES
${CMAKE_CURRENT_LIST_DIR}/core/pubnub_ssl.c
${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_openssl.c
${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_connect_openssl.c
${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_openssl_blocking_io.c
Expand Down Expand Up @@ -732,11 +790,18 @@ if (${EXAMPLES})
message(STATUS "Building callback examples")
set(EXAMPLE_LIST
pubnub_callback_sample
pubnub_callback_subloop_sample
subscribe_publish_callback_sample
subscribe_publish_from_callback
publish_callback_subloop_sample
publish_queue_callback_subloop)
${EXAMPLE_LIST})

if (NOT ${USE_SYNC_API})
set(EXAMPLE_LIST
pubnub_callback_subloop_sample
publish_callback_subloop_sample
publish_queue_callback_subloop
${EXAMPLE_LIST})
endif ()

if (${USE_SUBSCRIBE_EVENT_ENGINE})
set(EXAMPLE_LIST
subscribe_event_engine_sample
Expand All @@ -747,16 +812,24 @@ if (${EXAMPLES})
subscribe_publish_callback_sample # Only supports callback!
${CPP_EXAMPLE_LIST})
endif ()
else ()
endif ()
if (NOT ${USE_CALLBACK_API} OR ${USE_NTF_RUNTIME_SELECTION})
message(STATUS "Building sync examples")
set(EXAMPLE_LIST
metadata
pubnub_sync_subloop_sample
pubnub_sync_publish_retry
pubnub_publish_via_post_sample
pubnub_advanced_history_sample
pubnub_fetch_history_sample
cancel_subscribe_sync_sample)
cancel_subscribe_sync_sample
${EXAMPLE_LIST})

if (NOT ${USE_CALLBACK_API})
set(EXAMPLE_LIST
pubnub_sync_subloop_sample
${EXAMPLE_LIST})
endif ()

if (OPENSSL)
set(EXAMPLE_LIST
pubnub_crypto_module_sample
Expand All @@ -773,6 +846,13 @@ if (${EXAMPLES})
${EXAMPLE_LIST})
endif ()
endif ()

if (${USE_NTF_RUNTIME_SELECTION})
set(EXAMPLE_LIST
pubnub_api_enforcement_sample
${EXAMPLE_LIST})
endif ()

else ()
message(STATUS "Building example ${EXAMPLE}")
set(EXAMPLE_LIST ${EXAMPLE})
Expand Down
16 changes: 14 additions & 2 deletions core/pbauto_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static bool pubsub_keys_changed(pubnub_t const* pb_clone, pubnub_t const* pb)
|| (pb_clone->core.subscribe_key != pb->core.subscribe_key);
}

#if defined(PUBNUB_CALLBACK_API)
#if defined(PUBNUB_CALLBACK_API) && !defined(PUBNUB_NTF_RUNTIME_SELECTION)
#define add_heartbeat_in_progress(thumper_index)
#else
static void add_heartbeat_in_progress(unsigned thumper_index)
Expand All @@ -131,7 +131,13 @@ static void heartbeat_thump(pubnub_t* pb, pubnub_t* heartbeat_pb)

if (keys_changed) {
/** Used in sync environment while for callback it's an empty macro */
#if defined(PUBNUB_NTF_RUNTIME_SELECTION)
if (PNA_SYNC == pb->api_policy) {
add_heartbeat_in_progress(pb->thumperIndex);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have early exit from the function if pb->api_policy is PNA_CALLBACK and #if defined(PUBNUB_NTF_RUNTIME_SELECTION) by moving check to the function start? It will let us have only one check and remove similar code from the end of this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.. I didn't think about it.
There were so many places that I changes automatically so probably your solution seems to be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that inside the function there is an heartbeat operation anyway.
My question is if it is okay to early return?

#else
add_heartbeat_in_progress(pb->thumperIndex);
#endif
pubnub_mutex_unlock(pb->monitor);
pubnub_cancel(heartbeat_pb);
return;
Expand All @@ -156,7 +162,13 @@ static void heartbeat_thump(pubnub_t* pb, pubnub_t* heartbeat_pb)
pubnub_res_2_string(res));
}
/** Used in sync environment while for callback it's an empty macro */
#if defined(PUBNUB_NTF_RUNTIME_SELECTION)
if (PNA_SYNC == pb->api_policy) {
add_heartbeat_in_progress(pb->thumperIndex);
}
#else
add_heartbeat_in_progress(pb->thumperIndex);
#endif
}
pubnub_mutex_unlock(pb->monitor);
}
Expand Down Expand Up @@ -240,7 +252,7 @@ void pbauto_take_the_node_out(unsigned* indexes, unsigned i, unsigned* dimension
memmove(node_out, node_out + 1, (*dimension - i) * sizeof(unsigned));
}

#if defined(PUBNUB_CALLBACK_API)
#if defined(PUBNUB_CALLBACK_API) && !defined(PUBNUB_NTF_RUNTIME_SELECTION)
#define handle_heartbeats_in_progress()
#else
static void handle_heartbeats_in_progress(void)
Expand Down
2 changes: 1 addition & 1 deletion core/pbauto_heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct pubnub_heartbeat_data {

struct HeartbeatWatcherData {
struct pubnub_heartbeat_data heartbeat_data[PUBNUB_MAX_HEARTBEAT_THUMPERS] pubnub_guarded_by(mutw);
#if !defined(PUBNUB_CALLBACK_API)
#if !defined(PUBNUB_CALLBACK_API) || defined(PUBNUB_NTF_RUNTIME_SELECTION)
/** Array of thumper indices for which auto heartbeat transactions are currently in progress.
Used in sync environment.
*/
Expand Down
10 changes: 9 additions & 1 deletion core/pbcc_request_retry_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ void pbcc_request_retry_timer_start(
timer->pb->core.http_retry_count++;
pubnub_mutex_unlock(timer->pb->monitor);

#if defined(PUBNUB_NTF_RUNTIME_SELECTION)
if (PNA_SYNC == timer->pb->api_policy) {
pbcc_request_retry_timer_run_(timer);
} else {
#endif
#if defined(PUBNUB_CALLBACK_API)
if (pthread_create(&timer->timer_thread,
NULL,
Expand All @@ -144,6 +149,9 @@ void pbcc_request_retry_timer_start(
}
pubnub_mutex_unlock(timer->pb->monitor);
}
#if defined(PUBNUB_NTF_RUNTIME_SELECTION)
} /* if (PNA_SYNC == timer->pb->api_policy) */
#endif
#else
pbcc_request_retry_timer_run_(timer);
#endif // #if defined(PUBNUB_CALLBACK_API)
Expand Down Expand Up @@ -195,4 +203,4 @@ void* pbcc_request_retry_timer_run_(pbcc_request_retry_timer_t* timer)
pbcc_request_retry_timer_stop(timer);

return NULL;
}
}
2 changes: 1 addition & 1 deletion core/pbcc_subscribe_event_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,4 +1115,4 @@ char* pbcc_subscribe_ee_joined_array_elements_(
}

return joined_str;
}
}
Loading
Loading