Protocol Moudule URL for UltraMonkey-L7 V3(This is add on Module)
Revisão | 55c2ca61f5e5e9056e132bed69a0f05880938521 (tree) |
---|---|
Hora | 2013-07-21 16:08:31 |
Autor | root <root@kyou...> |
Commiter | root |
Fixed rslist_it_list and rslist_it_list_it data race bug.
@@ -2597,6 +2597,7 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2597 | 2597 | // check endpoint ( set by '-RS/--end-point' option and exist Real Server ) |
2598 | 2598 | for( rs_list_itr = rs_list_begin(); rs_list_itr != rs_list_end(); rs_list_itr = rs_list_next( rs_list_itr ) ){ |
2599 | 2599 | if ( *ep_list_it == rs_list_itr->tcp_endpoint && rs_list_itr->weight != 0 ) { |
2600 | + rw_scoped_lock inc_lock(rslist_it_list_ref_count_inc_mutex); | |
2600 | 2601 | rslist_it_list.push_back( rs_list_itr ); |
2601 | 2602 | is_realserver_match = true; |
2602 | 2603 | break; |
@@ -2605,12 +2606,14 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2605 | 2606 | ++ep_list_it; |
2606 | 2607 | } |
2607 | 2608 | if( is_realserver_match ){ |
2609 | + rw_scoped_lock inc_lock(rslist_it_list_ref_count_inc_mutex); | |
2608 | 2610 | // "rs_list_end()" is rslist_it_list's sentinel |
2609 | 2611 | rslist_it_list.push_back( rs_list_end() ); |
2610 | 2612 | // call Schedule Module in this function. |
2611 | 2613 | useScheduleTCP( thread_id, rslist_it_list, rs_endpoint ); |
2612 | 2614 | } |
2613 | 2615 | } |
2616 | + rw_scoped_lock inc_lock(rslist_it_list_ref_count_inc_mutex); | |
2614 | 2617 | rslist_it_list.clear(); |
2615 | 2618 | } |
2616 | 2619 |
@@ -150,6 +150,9 @@ private: | ||
150 | 150 | |
151 | 151 | // for use 'schedule_tcp' function |
152 | 152 | std::list< std::list< realserver>::iterator > rslist_it_list; |
153 | + unsigned int rslist_it_list_ref_count; | |
154 | + wr_mutex rslist_it_list_ref_count_inc_mutex; | |
155 | + | |
153 | 156 | std::list< std::list< realserver>::iterator >::iterator rslist_it_list_it; |
154 | 157 | std::list< realserver >::iterator begin_rslist_it(); |
155 | 158 | std::list< realserver >::iterator end_rslist_it(); |