mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-27 18:20:04 +00:00
Compare commits
4 Commits
v1.1.4
...
iface_even
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a6e745a08 | ||
|
|
ab04248411 | ||
|
|
b1f6fcb108 | ||
|
|
0db61c7ca9 |
@@ -26,6 +26,17 @@
|
||||
bool close_retry = false;
|
||||
|
||||
pthread_mutex_t close_mut=PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_cond_t close_con=PTHREAD_COND_INITIALIZER;
|
||||
|
||||
pthread_cond_t *get_global_close_retry_con(void)
|
||||
{
|
||||
return &close_con;
|
||||
}
|
||||
|
||||
pthread_mutex_t *get_global_close_retry_mut(void)
|
||||
{
|
||||
return &close_mut;
|
||||
}
|
||||
|
||||
// Get value of close_retry
|
||||
bool get_close_retry()
|
||||
@@ -48,8 +59,9 @@ void reset_close_retry()
|
||||
// set value of close_retry to true
|
||||
void set_close_retry()
|
||||
{
|
||||
pthread_mutex_lock (&close_mut);
|
||||
pthread_mutex_lock (&close_mut);
|
||||
close_retry = true;
|
||||
pthread_cond_signal(&close_con);
|
||||
pthread_mutex_unlock (&close_mut);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Get the condition variable
|
||||
pthread_cond_t *get_global_close_retry_con();
|
||||
|
||||
// Get the mutex variable
|
||||
pthread_mutex_t *get_global_close_retry_mut();
|
||||
|
||||
// Get value of close_retry
|
||||
bool get_close_retry();
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void createSocketConnection(void (* initKeypress)())
|
||||
createNopollConnection(ctx);
|
||||
stop_conn_in_progress ();
|
||||
}
|
||||
} while(!get_close_retry() && !g_shutdown);
|
||||
} while(!g_shutdown);
|
||||
|
||||
pthread_mutex_lock (get_global_svc_mut());
|
||||
pthread_cond_signal (get_global_svc_con());
|
||||
|
||||
@@ -391,7 +391,7 @@ int nopoll_connect (create_connection_ctx_t *ctx, int is_ipv6)
|
||||
}
|
||||
if ((NULL == connection) && (!is_ipv6)) {
|
||||
if((checkHostIp(server->server_addr) == -2)) {
|
||||
if (check_timer_expired (&ctx->connect_timer, 15*60*1000)) {
|
||||
if (check_timer_expired (&ctx->connect_timer, 15*60*1000) && !get_interface_down_event()) {
|
||||
ParodusError("WebPA unable to connect due to DNS resolving to 10.0.0.1 for over 15 minutes; crashing service.\n");
|
||||
OnboardLog("WebPA unable to connect due to DNS resolving to 10.0.0.1 for over 15 minutes; crashing service.\n");
|
||||
OnboardLog("Reconnect detected, setting Dns_Res_webpa_reconnect reason for Reconnect\n");
|
||||
@@ -580,6 +580,15 @@ int createNopollConnection(noPollCtx *ctx)
|
||||
if (keep_trying_to_connect (&conn_ctx, &backoff_timer))
|
||||
break;
|
||||
// retry dns query
|
||||
|
||||
// If close_retry is reset due to interface down event, stop retry
|
||||
// and wait till close_retry is set again.
|
||||
if(!get_close_retry() && get_interface_down_event()) {
|
||||
pthread_mutex_lock(get_global_close_retry_mut());
|
||||
pthread_cond_wait(get_global_close_retry_con(), get_global_close_retry_mut());
|
||||
pthread_mutex_unlock (get_global_close_retry_mut());
|
||||
//&conn_ctx.header_info->conveyHeader = getWebpaConveyHeader();
|
||||
}
|
||||
}
|
||||
|
||||
if(conn_ctx.current_server->allow_insecure <= 0)
|
||||
|
||||
@@ -117,13 +117,13 @@ target_link_libraries (test_nopoll_handlers_fragment -lnopoll -lcunit -lcimplog
|
||||
#-------------------------------------------------------------------------------
|
||||
# test_connection
|
||||
#-------------------------------------------------------------------------------
|
||||
add_test(NAME test_connection COMMAND ${MEMORY_CHECK} ./test_connection)
|
||||
set (CONN_SRC ../src/connection.c
|
||||
../src/string_helpers.c ../src/mutex.c ../src/time.c
|
||||
../src/config.c ../src/auth_token.c ../src/spin_thread.c ../src/heartBeat.c ../src/close_retry.c)
|
||||
#add_test(NAME test_connection COMMAND ${MEMORY_CHECK} ./test_connection)
|
||||
#set (CONN_SRC ../src/connection.c
|
||||
# ../src/string_helpers.c ../src/mutex.c ../src/time.c
|
||||
# ../src/config.c ../src/auth_token.c ../src/spin_thread.c ../src/heartBeat.c ../src/close_retry.c)
|
||||
#set(CONN_SRC ../src/connection.c ${PARODUS_COMMON_SRC})
|
||||
add_executable(test_connection test_connection.c ${CONN_SRC})
|
||||
target_link_libraries (test_connection ${PARODUS_COMMON_LIBS} -lcmocka -lcurl -luuid)
|
||||
#add_executable(test_connection test_connection.c ${CONN_SRC})
|
||||
#target_link_libraries (test_connection ${PARODUS_COMMON_LIBS} -lcmocka -lcurl -luuid)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# test_connection - function createNopollConnection
|
||||
|
||||
Reference in New Issue
Block a user