void down_thread_run();
//! realserver remove
//! @param[in] target endpoint
- void realserver_remove(boost::asio::ip::tcp::endpoint &);
+ void realserver_remove(const boost::asio::ip::tcp::endpoint &);
protected:
typedef data_buff_base<boost::asio::ip::tcp> tcp_data;
typedef boost::asio::ip::tcp::endpoint endpoint;
bool downqos_alert_flag; //! downstream QoS alert flag
bool sessionpool_alert_flag; //! sessionpool alert flag
+ bool adm_cmd_wait_flag; //! wait for l7vsadm done
+ boost::mutex adm_cmd_wait_flag_mutex;
+ boost::condition adm_cmd_wait_flag_cond;
+
void load_parameter(l7vs::error_code &);
virtual void handle_replication_interrupt(
fmt % boost::this_thread::get_id();
Logger::putLogDebug(LOG_CAT_L7VSD_SESSION, 999, fmt.str(), __FILE__, __LINE__);
}
- break;
+ //break;
+ realserver_remove(endpoint_);
+ return;
case SORRY_STATE_ENABLE:
//----Debug log----------------------------------------------------------------------
if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))) {
//! real server remove
//! @param[in] target endpoint
-void tcp_session::realserver_remove(endpoint &target_endpoint)
+void tcp_session::realserver_remove(const endpoint &target_endpoint)
{
+
+ if (target_endpoint != realserver_endpoint && target_endpoint != connecting_endpoint) return;
+
tcp_thread_message *up_msg = new tcp_thread_message;
- up_thread_function_pair up_func = up_thread_function_array[UP_FUNC_REALSERVER_CHECK];
+ up_thread_function_pair up_func = up_thread_function_array[UP_FUNC_EXIT];
up_msg->message = up_func.second;
up_msg->endpoint_info = target_endpoint;
#ifdef DEBUG
- up_msg->func_tag_name = func_tag_to_string(UP_FUNC_REALSERVER_CHECK);
+ up_msg->func_tag_name = func_tag_to_string(UP_FUNC_EXIT);
{
boost::format fmt("Thread ID[%d] up_queue.push : %s");
- fmt % boost::this_thread::get_id() % func_tag_to_string(UP_FUNC_REALSERVER_CHECK);
+ fmt % boost::this_thread::get_id() % func_tag_to_string(UP_FUNC_EXIT);
Logger::putLogInfo(LOG_CAT_L7VSD_SESSION, 999, fmt.str(), __FILE__, __LINE__);
}
#endif
while (!up_thread_message_que.push(up_msg)) {}
upthread_status_cond.notify_one();
+
+ tcp_thread_message *down_msg = new tcp_thread_message;
+ down_thread_function_pair down_func = down_thread_function_array[DOWN_FUNC_EXIT];
+ down_msg->message = down_func.second;
+ down_msg->endpoint_info = target_endpoint;
+#ifdef DEBUG
+ down_msg->func_tag_name = func_tag_to_string(DOWN_FUNC_EXIT);
+ {
+ boost::format fmt("Thread ID[%d] down_queue.push : %s");
+ fmt % boost::this_thread::get_id() % func_tag_to_string(DOWN_FUNC_EXIT);
+ Logger::putLogInfo(LOG_CAT_L7VSD_SESSION, 999, fmt.str(), __FILE__, __LINE__);
+ }
+#endif
+ while (!down_thread_message_que.push(down_msg)) {}
+ downthread_status_cond.notify_one();
}
upqos_alert_flag = false;
downqos_alert_flag = false;
sessionpool_alert_flag = false;
+ adm_cmd_wait_flag = false;
rs_list.clear();
protomod = NULL;
return;
}
+ {
+ boost::mutex::scoped_lock lock(adm_cmd_wait_flag_mutex);
+ if (unlikely(adm_cmd_wait_flag)){
+ adm_cmd_wait_flag_cond.wait(lock);
+ }
+ }
+
session_thread_control *stc_ptr_noconst = const_cast<session_thread_control *>(stc_ptr);
if (unlikely(err == boost::asio::error::operation_aborted)) { // nomal exit case
}
}
- //pause active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_on, _1));
-
//add realserver
for (std::vector<realserver_element>::iterator itr = in_element.realserver_vector.begin();
itr != in_element.realserver_vector.end();
rs_list.push_back(rs);
}
- //run active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_off, _1));
-
if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
boost::format formatter("out_function: void virtualservice_tcp::add_realserver( "
"const l7vs::virtualservice_element& in,"
}
}
- //pause active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_on, _1));
+ //lock adm_cmd_wait_flag on
+ adm_cmd_wait_flag_mutex.lock();
+ adm_cmd_wait_flag = true;
+ adm_cmd_wait_flag_cond.notify_one();
+ adm_cmd_wait_flag_mutex.unlock();
//edit realserver
for (std::vector<realserver_element>::iterator itr = in_element.realserver_vector.begin();
}
}
- //run active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_off, _1));
+ //lock adm_cmd_wait_flag off
+ adm_cmd_wait_flag_mutex.lock();
+ adm_cmd_wait_flag = false;
+ adm_cmd_wait_flag_cond.notify_one();
+ adm_cmd_wait_flag_mutex.unlock();
err.setter(false, "");
if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
}
}
- //pause active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_on, _1));
+ //lock adm_cmd_wait_flag on
+ adm_cmd_wait_flag_mutex.lock();
+ adm_cmd_wait_flag = true;
+ adm_cmd_wait_flag_cond.notify_one();
+ adm_cmd_wait_flag_mutex.unlock();
//del realserver
for (std::vector<realserver_element>::iterator itr = in_element.realserver_vector.begin();
}
}
- //run active sessions
- active_sessions.do_all(boost::bind(&session_thread_control::session_pause_off, _1));
+ //lock adm_cmd_wait_flag off
+ adm_cmd_wait_flag_mutex.lock();
+ adm_cmd_wait_flag = false;
+ adm_cmd_wait_flag_cond.notify_one();
+ adm_cmd_wait_flag_mutex.unlock();
if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) {
boost::format formatter("out_function: void virtualservice_tcp::del_realserver( "