The shutdown function was invoked every time we call the finalize function. Shutdown the log agent only if we finalize a log client successfully. --- src/log/agent/lga_agent.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc index 393993f05..61424f154 100644 --- a/src/log/agent/lga_agent.cc +++ b/src/log/agent/lga_agent.cc @@ -695,20 +695,20 @@ SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) { if (client == nullptr) { TRACE("No log client with such handle"); ais_rc = SA_AIS_ERR_BAD_HANDLE; - goto done; + return ais_rc; } if (client->FetchAndDecreaseRefCounter(__func__, &updated) != 0) { // DO NOT delete this @client as it is being used by somewhere (>0) // Or it is being deleted by other thread (=-1) ais_rc = SA_AIS_ERR_TRY_AGAIN; - goto done; + return ais_rc; } } // end critical section if (client->HaveLogStreamInUse() == true) { ais_rc = SA_AIS_ERR_TRY_AGAIN; - goto done; + return ais_rc; } // No LOG server. No service is provided. @@ -716,7 +716,7 @@ SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) { // We have a server but it is temporary unavailable. Client may try again TRACE("%s lgs_state = LGS no active", __func__); ais_rc = SA_AIS_ERR_TRY_AGAIN; - goto done; + return ais_rc; } // Avoid the recovery thread block operation on done-recovery client @@ -728,7 +728,7 @@ SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) { // The client may try again TRACE("%s lga_state = LGA auto recovery ongoing (2)", __func__); ais_rc = SA_AIS_ERR_TRY_AGAIN; - goto done; + return ais_rc; } if (is_lga_recovery_state(RecoveryState::kRecovery1)) { @@ -740,7 +740,7 @@ SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) { TRACE("\t Client is not initialized. Remove it from database"); ScopeLock critical_section(get_delete_obj_sync_mutex_); RemoveLogClient(&client); - goto done; + return ais_rc; } TRACE("\t Client is initialized"); } @@ -757,7 +757,6 @@ SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) { } } -done: if (CountClient() == 0) { // Stop recovery thread if it's running stop_recovery2_thread(); @@ -767,9 +766,11 @@ done: TRACE("lga_shutdown FAILED"); ais_rc = SA_AIS_ERR_LIBRARY; } - m_NCS_SEL_OBJ_RMV_IND(&init_clm_status_sel_, true, false); - m_NCS_SEL_OBJ_RMV_IND(&log_server_up_sel_, true, false); - atomic_data_.waiting_log_server_up = true; + if (!atomic_data_.waiting_log_server_up) { + m_NCS_SEL_OBJ_RMV_IND(&init_clm_status_sel_, true, false); + m_NCS_SEL_OBJ_RMV_IND(&log_server_up_sel_, true, false); + atomic_data_.waiting_log_server_up = true; + } } TRACE_LEAVE2("ais_rc = %s", saf_error(ais_rc)); -- 2.17.1 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel