//endpoint is matched
if (ret == 0)
{
- //find the rs_endpoint in rs_list
- rs_list_lock();
-
- rs_list_itr = rs_list_begin();
int is_match = 0;
-
- while ( rs_list_itr != rs_list_end())
+ //find the rs_endpoint in rs_list
{
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
- if ( rs_list_itr->tcp_endpoint == rs_endpoint )
+ rs_list_itr = rs_list_begin();
+
+ while ( rs_list_itr != rs_list_end())
{
- is_match = 1;
- break;
- }
- rs_list_itr = rs_list_next( rs_list_itr );
- }
+ if ( rs_list_itr->tcp_endpoint == rs_endpoint )
+ {
+ is_match = 1;
+ break;
+ }
- rs_list_unlock();
+ rs_list_itr = rs_list_next( rs_list_itr );
+ }
+ }
//endpoint is matched in the list
if (is_match)
{
// init rs_endpoint
rs_endpoint = init_endpoint;
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
+ schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, rs_endpoint);
+ }
- schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, rs_endpoint);
/*-------- DEBUG LOG --------*/
if (unlikely(LOG_LV_DEBUG == getloglevel()))
{
rs_endpoint = init_endpoint;
//call schedule_module's schedule function, get realserver endpoint
- schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, rs_endpoint);
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
+ schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, rs_endpoint);
+ }
/*-------- DEBUG LOG --------*/
if (unlikely(LOG_LV_DEBUG == getloglevel()))
// schedule the endpoint
boost::asio::ip::tcp::endpoint temp_endpoint;
boost::asio::ip::tcp::endpoint comp_endpoint; // for compare the endpoint
- schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
+ schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ }
+
if (temp_endpoint != comp_endpoint)
{
// success for get the endpoint by reschedule
if (ret == 0)
{
+ int is_match = 0;
//find the rs_endpoint in the rs_list
- rs_list_lock();
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
- rs_list_itr = rs_list_begin();
- int is_match = 0;
+ rs_list_itr = rs_list_begin();
- while (rs_list_itr != rs_list_end())
- {
- if (rs_list_itr->tcp_endpoint == threaddata->selected_realserver)
+ while (rs_list_itr != rs_list_end())
{
- is_match = 1;
- break;
- }
+ if (rs_list_itr->tcp_endpoint == threaddata->selected_realserver)
+ {
+ is_match = 1;
+ break;
+ }
- rs_list_itr = rs_list_next(rs_list_itr);
+ rs_list_itr = rs_list_next(rs_list_itr);
+ }
}
if (is_match)
// reschedule mode
boost::asio::ip::tcp::endpoint temp_endpoint;
boost::asio::ip::tcp::endpoint comp_endpoint; // for compare the endpoint
- schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
+ schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ }
+
if (temp_endpoint != comp_endpoint)
{
// get the endpoint by reschedule successfully
// reschedule mode
boost::asio::ip::tcp::endpoint temp_endpoint;
boost::asio::ip::tcp::endpoint comp_endpoint; // for compare the endpoint
- schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ {
+ rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock);
+ schedule_tcp(thread_id, rs_list_begin, rs_list_end, rs_list_next, temp_endpoint);
+ }
+
if (temp_endpoint != comp_endpoint)
{
// get the endpoint by reschedule successfully
//! called from after sorryserver select
//! @param[in] upstream thread id
//! @param[in] sorryserver endppiont reference
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorryserver_select(
const boost::thread::id thread_id,
boost::asio::ip::tcp::endpoint& sorry_endpoint)
//! @param[in] upstream thread id
//! @param[out] send buffer reference.
//! @param[out] send length
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorryserver_connect(
const boost::thread::id thread_id,
boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
//! called from after sorryserver connection fail
//! @param[in] upstream thread id
//! @param[in] sorryserver endpoint reference.
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorryserver_connection_fail(
const boost::thread::id thread_id,
const boost::asio::ip::tcp::endpoint& sorry_endpoint)
//! called from after sorryserver send
//! @param[in] upstream thread id
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorryserver_send(
const boost::thread::id thread_id)
{
//! @param[in] sorryserver endpoint reference
//! @param[in] recive from realserver buffer reference.
//! @param[in] recv data length
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorryserver_recv(
const boost::thread::id thread_id,
const boost::asio::ip::tcp::endpoint& sorry_endpoint,
//! call from sorry mode event. use upstream thread and downstream thread
//! @param[in] upstream and downstream thread id(check! one thread one event and first time call pattern)
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorry_enable(
const boost::thread::id thread_id)
{
//! call from sorry mode disable. use upstream thread and downstream thread.
//! @param[in] upstream and downstream thread id(check! one thread one event)
-//! @return session use EVENT mode(STOP).
+//! @return session use EVENT mode.
protocol_module_base::EVENT_TAG protocol_module_sslid::handle_sorry_disable(
const boost::thread::id thread_id)
{