Compare commits

..

4 Commits

Author SHA1 Message Date
Shilpa Seshadri
8c99132287 Fix build failure 2019-11-13 23:14:08 -08:00
Shilpa Seshadri
680b0471ab Merge branch 'ifcdown' of https://github.com/bill1600/parodus into event_handler 2019-11-13 19:35:30 -08:00
Shilpa Seshadri
4bd5223f08 Merge branch 'master' of https://github.com/Comcast/parodus into event_handler 2019-11-13 18:41:20 -08:00
Shilpa Seshadri
9a2613c0da Invoke conn_close only from main thread 2019-11-04 23:18:50 -08:00
3 changed files with 15 additions and 9 deletions

View File

@@ -169,10 +169,11 @@ void createSocketConnection(void (* initKeypress)())
seshat_registered = __registerWithSeshat(); seshat_registered = __registerWithSeshat();
} }
// If interface down event is set, wait till interface is up again.
if (get_interface_down_event ()) if (get_interface_down_event ())
if (0 != wait_while_interface_down ()) if (0 != wait_while_interface_down ())
break; break;
if(get_close_retry()) if(get_close_retry())
{ {
ParodusInfo("close_retry is %d, hence closing the connection and retrying\n", get_close_retry()); ParodusInfo("close_retry is %d, hence closing the connection and retrying\n", get_close_retry());

View File

@@ -509,7 +509,7 @@ int wait_connection_ready (create_connection_ctx_t *ctx)
if(wait_status == 307 || wait_status == 302 || wait_status == 303) // only when there is a http redirect if(wait_status == 307 || wait_status == 302 || wait_status == 303) // only when there is a http redirect
{ {
char *redirect_ptr = redirectURL; char *redirect_ptr = redirectURL;
ParodusInfo("Received temporary redirection response message %s\n", redirectURL); ParodusError("Received temporary redirection response message %s\n", redirectURL);
// Extract server Address and port from the redirectURL // Extract server Address and port from the redirectURL
if (strncmp (redirect_ptr, "Redirect:", 9) == 0) if (strncmp (redirect_ptr, "Redirect:", 9) == 0)
redirect_ptr += 9; redirect_ptr += 9;
@@ -610,6 +610,7 @@ int keep_trying_to_connect (create_connection_ctx_t *ctx,
if (rtn == CONN_WAIT_ACTION_RETRY) // if redirected or build_headers if (rtn == CONN_WAIT_ACTION_RETRY) // if redirected or build_headers
continue; continue;
// If interface down event is set, stop retry // If interface down event is set, stop retry
// and wait till interface is up again. // and wait till interface is up again.
if(get_interface_down_event()) { if(get_interface_down_event()) {
@@ -625,6 +626,7 @@ int keep_trying_to_connect (create_connection_ctx_t *ctx,
!= BACKOFF_DELAY_TAKEN) // shutdown or cond wait error != BACKOFF_DELAY_TAKEN) // shutdown or cond wait error
return false; return false;
} }
if (rtn == CONN_WAIT_RETRY_DNS) if (rtn == CONN_WAIT_RETRY_DNS)
return false; //find_server again return false; //find_server again
// else retry // else retry
@@ -642,15 +644,17 @@ int wait_while_interface_down()
set_global_conn(NULL); set_global_conn(NULL);
while (get_interface_down_event ()) { while (get_interface_down_event ()) {
pthread_mutex_lock(get_interface_down_mut()); pthread_mutex_lock(get_interface_down_mut());
rtn = pthread_cond_wait(get_interface_down_con(), get_interface_down_mut()); rtn = pthread_cond_wait(get_interface_down_con(), get_interface_down_mut());
pthread_mutex_unlock (get_interface_down_mut()); pthread_mutex_unlock (get_interface_down_mut());
if (rtn != 0) if (rtn != 0)
ParodusError ParodusError("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
if ((rtn != 0) || g_shutdown) { if ((rtn != 0) || g_shutdown)
return -1; return -1;
}
} }
return 0; return 0;
} }
@@ -696,6 +700,7 @@ int createNopollConnection(noPollCtx *ctx)
set_current_server (&conn_ctx); set_current_server (&conn_ctx);
if (keep_trying_to_connect (&conn_ctx, &backoff_timer)) if (keep_trying_to_connect (&conn_ctx, &backoff_timer))
break; break;
// retry dns query // retry dns query
} }

View File

@@ -146,7 +146,7 @@ void __report_log (noPollCtx * ctx, noPollDebugLevel level, const char * log_msg
if (level == NOPOLL_LEVEL_DEBUG) if (level == NOPOLL_LEVEL_DEBUG)
{ {
ParodusInfo("%s\n", log_msg); //ParodusPrint("%s\n", log_msg);
} }
if (level == NOPOLL_LEVEL_INFO) if (level == NOPOLL_LEVEL_INFO)
{ {
@@ -154,7 +154,7 @@ void __report_log (noPollCtx * ctx, noPollDebugLevel level, const char * log_msg
} }
if (level == NOPOLL_LEVEL_WARNING) if (level == NOPOLL_LEVEL_WARNING)
{ {
ParodusInfo("%s\n", log_msg); ParodusPrint("%s\n", log_msg);
} }
if (level == NOPOLL_LEVEL_CRITICAL) if (level == NOPOLL_LEVEL_CRITICAL)
{ {