UltraMonkey-L7 V3(multi-thread implementation)
Révision | a7ed71adab167d1ac77d3b2bebfe45bcf316c3d7 (tree) |
---|---|
l'heure | 2011-12-28 15:28:55 |
Auteur | takeda kenji <takeda@n026...> |
Commiter | takeda kenji |
・データ構造を変更
パターンとendpointのペアをpairで管理していたところをmapに変更。
それにともない、array-sregexの変換mapをlist< pair< array, sregex > >に変更。
・handle_realserver_slectの処理を一部変更
接続先のReal Serverが落ちていた場合に、Sorryフラグをオンにするように変更。
@@ -34,11 +34,9 @@ | ||
34 | 34 | #include "protocol_module_url.h" |
35 | 35 | #include "utility.h" |
36 | 36 | |
37 | - | |
38 | 37 | #include <boost/lambda/lambda.hpp> |
39 | 38 | #include <boost/lambda/if.hpp> |
40 | 39 | |
41 | - | |
42 | 40 | namespace l7vs |
43 | 41 | { |
44 | 42 | #ifdef DEBUG |
@@ -412,9 +410,11 @@ protocol_module_base::check_message_result protocol_module_url::check_parameter( | ||
412 | 410 | try { |
413 | 411 | vec_str_it it = args.begin(); |
414 | 412 | vec_str_it it_end = args.end(); |
415 | - pattern_endpoint_pairlist ptn_ep_pairlist_for_check; | |
416 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it; | |
417 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it_end; | |
413 | + | |
414 | + pattern_endpointlist_map ptn_eplist_map_for_check; | |
415 | + pattern_endpointlist_map_it ptn_eplist_map_it; | |
416 | + pattern_endpointlist_map_it ptn_eplist_map_it_end; | |
417 | + | |
418 | 418 | boost::lambda::placeholder1_type X; |
419 | 419 | |
420 | 420 | //loop option strings |
@@ -562,11 +562,10 @@ protocol_module_base::check_message_result protocol_module_url::check_parameter( | ||
562 | 562 | boost::array<char,MAX_OPTION_SIZE> ary_buf; |
563 | 563 | strcpy( ary_buf.begin(), it->c_str() ); |
564 | 564 | |
565 | - ptn_ep_pairlist_it_end = ptn_ep_pairlist_for_check.end(); | |
566 | - ptn_ep_pairlist_it = std::find_if( ptn_ep_pairlist_for_check.begin(), ptn_ep_pairlist_it_end, | |
567 | - ( &X->*( &pattern_endpoint_pair::first ) == ary_buf ) ); | |
568 | - | |
569 | - if( ptn_ep_pairlist_it != ptn_ep_pairlist_it_end ){ | |
565 | + ptn_eplist_map_it_end = ptn_eplist_map_for_check.end(); | |
566 | + ptn_eplist_map_it = ptn_eplist_map_for_check.find( ary_buf ); | |
567 | + | |
568 | + if( ptn_eplist_map_it != ptn_eplist_map_it_end ){ | |
570 | 569 | check_result.flag = false; |
571 | 570 | std::ostringstream ostr; |
572 | 571 | ostr << "Pattern '" << *it << "' is already set."; |
@@ -583,7 +582,7 @@ protocol_module_base::check_message_result protocol_module_url::check_parameter( | ||
583 | 582 | }else{ |
584 | 583 | check_result.flag = false; |
585 | 584 | std::ostringstream ostr; |
586 | - ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'.(デバッグ用01)"; | |
585 | + ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'."; | |
587 | 586 | check_result.message = ostr.str(); |
588 | 587 | putLogError(9999, check_result.message, __FILE__, __LINE__); |
589 | 588 | break; |
@@ -596,17 +595,17 @@ protocol_module_base::check_message_result protocol_module_url::check_parameter( | ||
596 | 595 | } else { |
597 | 596 | check_result.flag = false; |
598 | 597 | std::ostringstream ostr; |
599 | - ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'.(デバッグ用02)"; | |
598 | + ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'."; | |
600 | 599 | check_result.message = ostr.str(); |
601 | 600 | putLogError(9999, check_result.message, __FILE__, __LINE__); |
602 | 601 | break; |
603 | 602 | } |
604 | 603 | |
605 | - ptn_ep_pairlist_for_check.push_back( | |
606 | - std::pair< | |
604 | + ptn_eplist_map_for_check.insert( | |
605 | + std::map< | |
607 | 606 | boost::array< char, MAX_OPTION_SIZE >, |
608 | 607 | std::list< tcp_type::endpoint > |
609 | - >( ary_buf, temp_endpoint_list ) | |
608 | + >::value_type( ary_buf, temp_endpoint_list ) | |
610 | 609 | ); |
611 | 610 | |
612 | 611 | } |
@@ -766,9 +765,9 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co | ||
766 | 765 | try { |
767 | 766 | vec_str_it it = args.begin(); |
768 | 767 | vec_str_it it_end = args.end(); |
769 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it; | |
770 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it_end; | |
771 | - boost::lambda::placeholder1_type X; | |
768 | + | |
769 | + pattern_endpointlist_map_it ptn_eplist_map_it; | |
770 | + pattern_endpointlist_map_it ptn_eplist_map_it_end; | |
772 | 771 | |
773 | 772 | //loop option strings |
774 | 773 | while( it != it_end ){ |
@@ -920,16 +919,15 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co | ||
920 | 919 | boost::array<char,MAX_OPTION_SIZE> ary_buf; |
921 | 920 | strcpy( ary_buf.begin(), it->c_str() ); |
922 | 921 | |
923 | - ptn_ep_pairlist_it_end = ptn_ep_pairlist.end(); | |
924 | - ptn_ep_pairlist_it = std::find_if( ptn_ep_pairlist.begin(), ptn_ep_pairlist_it_end, | |
925 | - ( &X->*( &pattern_endpoint_pair::first ) == ary_buf ) ); | |
926 | - | |
927 | - if( ptn_ep_pairlist_it != ptn_ep_pairlist_it_end ){ | |
922 | + ptn_eplist_map_it = ptn_eplist_map.find( ary_buf ); | |
923 | + ptn_eplist_map_it_end = ptn_eplist_map.end(); | |
924 | + | |
925 | + if( ptn_eplist_map_it != ptn_eplist_map_it_end ){ | |
928 | 926 | check_result.flag = false; |
929 | 927 | std::ostringstream ostr; |
930 | 928 | ostr << "Pattern '" << *it << "' is already set."; |
931 | 929 | check_result.message = ostr.str(); |
932 | - putLogError(9999, check_result.message, __FILE__, __LINE__); | |
930 | + putLogError( 9999, check_result.message, __FILE__, __LINE__); | |
933 | 931 | break; |
934 | 932 | } |
935 | 933 |
@@ -941,7 +939,7 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co | ||
941 | 939 | }else{ |
942 | 940 | check_result.flag = false; |
943 | 941 | std::ostringstream ostr; |
944 | - ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'.(デバッグ用01)"; | |
942 | + ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'."; | |
945 | 943 | check_result.message = ostr.str(); |
946 | 944 | putLogError(9999, check_result.message, __FILE__, __LINE__); |
947 | 945 | break; |
@@ -954,25 +952,25 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co | ||
954 | 952 | } else { |
955 | 953 | check_result.flag = false; |
956 | 954 | std::ostringstream ostr; |
957 | - ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'.(デバッグ用02)"; | |
955 | + ostr << "You have to set option '-RS/--end-point' after '-P/--pattern-match'."; | |
958 | 956 | check_result.message = ostr.str(); |
959 | 957 | putLogError(9999, check_result.message, __FILE__, __LINE__); |
960 | 958 | break; |
961 | 959 | } |
962 | 960 | |
963 | - ptn_ep_pairlist.push_back( | |
964 | - std::pair< | |
961 | + ptn_eplist_map.insert( | |
962 | + std::map< | |
965 | 963 | boost::array< char, MAX_OPTION_SIZE >, |
966 | 964 | std::list< tcp_type::endpoint > |
967 | - >( ary_buf, temp_endpoint_list ) | |
965 | + >::value_type( ary_buf, temp_endpoint_list ) | |
966 | + ); | |
967 | + | |
968 | + ptnsrgx_converter_pairlist.push_back( | |
969 | + std::pair< | |
970 | + boost::array< char, MAX_OPTION_SIZE >, | |
971 | + sregex | |
972 | + >( ary_buf, sregex::compile( ary_buf.data() ) ) | |
968 | 973 | ); |
969 | - | |
970 | - keyary_sregex_converter_map.insert( | |
971 | - std::map< | |
972 | - boost::array< char, MAX_OPTION_SIZE >, | |
973 | - sregex | |
974 | - >::value_type( ary_buf, sregex::compile( ary_buf.data() ) ) | |
975 | - ); | |
976 | 974 | |
977 | 975 | } |
978 | 976 | //next item not exist |
@@ -1050,7 +1048,7 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co | ||
1050 | 1048 | formatter % check_result.flag % check_result.message; |
1051 | 1049 | putLogDebug(100016, formatter.str(), __FILE__, __LINE__); |
1052 | 1050 | } |
1053 | - | |
1051 | + | |
1054 | 1052 | return check_result; |
1055 | 1053 | |
1056 | 1054 | } |
@@ -2552,12 +2550,11 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2552 | 2550 | } |
2553 | 2551 | |
2554 | 2552 | //endpoint check |
2555 | - receive_data_it = session_data->receive_data_map.find(session_data->client_endpoint_tcp); | |
2553 | + receive_data_it = session_data->receive_data_map.find( session_data->client_endpoint_tcp ); | |
2556 | 2554 | if (unlikely(receive_data_it == session_data->receive_data_map.end())) { |
2557 | 2555 | boost::format formatter("Invalid endpoint. thread id : %d."); |
2558 | 2556 | formatter % boost::this_thread::get_id(); |
2559 | 2557 | putLogError(100043, formatter.str(), __FILE__, __LINE__); |
2560 | - session_thread_data_map_mutex.unlock(); | |
2561 | 2558 | throw - 1; |
2562 | 2559 | } |
2563 | 2560 |
@@ -2567,7 +2564,7 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2567 | 2564 | send_status_it it_end = recv_data.send_status_list.end(); |
2568 | 2565 | |
2569 | 2566 | //status list check |
2570 | - it = std::find_if(it, it_end, data_send_ok()); | |
2567 | + it = std::find_if( it, it_end, data_send_ok() ); | |
2571 | 2568 | if (unlikely(it == it_end)) { |
2572 | 2569 | boost::format formatter("Sending possible data is not existed. thread id : %d."); |
2573 | 2570 | formatter % boost::this_thread::get_id(); |
@@ -2576,40 +2573,47 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2576 | 2573 | } |
2577 | 2574 | |
2578 | 2575 | // endpoint decide |
2579 | - ret = find_uri(recv_data.receive_buffer + it->send_offset, it->send_possible_size, url_offset, url_offset_len); | |
2576 | + ret = find_uri( recv_data.receive_buffer + it->send_offset, it->send_possible_size, url_offset, url_offset_len ); | |
2580 | 2577 | if( ret ){ |
2581 | 2578 | std::string tempstr = recv_data.receive_buffer; |
2582 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it = ptn_ep_pairlist.begin(); | |
2583 | - pattern_endpoint_pairlist_it ptn_ep_pairlist_it_end = ptn_ep_pairlist.end(); | |
2579 | + | |
2580 | + pattern_sregex_converter_pairlist_it ptnsrgx_cvt_pairlist_it = ptnsrgx_converter_pairlist.begin(); | |
2581 | + pattern_sregex_converter_pairlist_it ptnsrgx_cvt_pairlist_it_end = ptnsrgx_converter_pairlist.end(); | |
2584 | 2582 | |
2585 | 2583 | sregex reg; |
2586 | - // indicate Real Server found or not found. | |
2587 | - bool is_match = false; | |
2584 | + // indicate client sends URL is matched | |
2585 | + bool is_regex_match = false; | |
2586 | + // indicate Real Server found | |
2587 | + bool is_realserver_match = false; | |
2588 | 2588 | |
2589 | 2589 | // search URL pattern |
2590 | - while( ptn_ep_pairlist_it != ptn_ep_pairlist_it_end ){ | |
2590 | + while( ptnsrgx_cvt_pairlist_it != ptnsrgx_cvt_pairlist_it_end ){ | |
2591 | 2591 | |
2592 | - reg = keyary_sregex_converter_map[ ptn_ep_pairlist_it->first ]; | |
2592 | + reg = ptnsrgx_cvt_pairlist_it->second; | |
2593 | + is_regex_match = regex_match( tempstr.substr( url_offset, url_offset_len ), reg ); | |
2593 | 2594 | |
2594 | - if( regex_match( tempstr.substr( url_offset, url_offset_len ), reg ) ){ | |
2595 | + if( is_regex_match ){ | |
2596 | + std::list< boost::asio::ip::tcp::endpoint >::iterator ep_list_it | |
2597 | + = ( ptn_eplist_map.find( ptnsrgx_cvt_pairlist_it->first ) )->second.begin(); | |
2598 | + std::list< boost::asio::ip::tcp::endpoint >::iterator ep_list_it_end | |
2599 | + = ( ptn_eplist_map.find( ptnsrgx_cvt_pairlist_it->first ) )->second.end(); | |
2595 | 2600 | // find the rs_endpoint in the rs_list |
2596 | 2601 | { |
2597 | 2602 | rs_list_scoped_lock scoped_lock(rs_list_lock, rs_list_unlock); |
2598 | - std::list< boost::asio::ip::tcp::endpoint >::iterator ep_list_it = ptn_ep_pairlist_it->second.begin(); | |
2599 | - | |
2600 | - while( ep_list_it != ptn_ep_pairlist_it->second.end() ){ | |
2601 | 2603 | |
2602 | - // check endpoint ( set by '-RS/--end-point' option and already set at Virtual Service ) | |
2604 | + // while( ep_list_it != ptn_ep_pairlist_it->second.end() ){ | |
2605 | + while( ep_list_it != ep_list_it_end ){ | |
2606 | + // check endpoint ( set by '-RS/--end-point' option and exist Real Server ) | |
2603 | 2607 | for( rs_list_itr = rs_list_begin(); rs_list_itr != rs_list_end(); rs_list_itr = rs_list_next( rs_list_itr ) ){ |
2604 | 2608 | if ( *ep_list_it == rs_list_itr->tcp_endpoint && rs_list_itr->weight != 0 ) { |
2605 | 2609 | rslist_it_list.push_back( rs_list_itr ); |
2606 | - is_match = true; | |
2610 | + is_realserver_match = true; | |
2607 | 2611 | break; |
2608 | 2612 | } |
2609 | 2613 | } |
2610 | 2614 | ++ep_list_it; |
2611 | 2615 | } |
2612 | - if( is_match ){ | |
2616 | + if( is_realserver_match ){ | |
2613 | 2617 | // "rs_list_end()" is rslist_it_list's sentinel |
2614 | 2618 | rslist_it_list.push_back( rs_list_end() ); |
2615 | 2619 | // call Schedule Module in this function. |
@@ -2618,44 +2622,62 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select( | ||
2618 | 2622 | } |
2619 | 2623 | rslist_it_list.clear(); |
2620 | 2624 | } |
2621 | - if( is_match ){ | |
2625 | + | |
2626 | + if( is_realserver_match ){ | |
2622 | 2627 | break; |
2623 | 2628 | } |
2624 | 2629 | |
2625 | - ++ptn_ep_pairlist_it; | |
2630 | + ++ptnsrgx_cvt_pairlist_it; | |
2626 | 2631 | } |
2627 | 2632 | |
2628 | - if( is_match && rs_endpoint != tmp_endpoint ){ | |
2629 | - // get the endpoint successfullyi | |
2630 | - session_data->target_endpoint = rs_endpoint; | |
2631 | - status = REALSERVER_CONNECT; | |
2633 | + if( is_regex_match ){ | |
2634 | + if( is_realserver_match && rs_endpoint != tmp_endpoint ){ | |
2635 | + // get the endpoint successfullyi | |
2636 | + session_data->target_endpoint = rs_endpoint; | |
2637 | + status = REALSERVER_CONNECT; | |
2638 | + }else{ | |
2639 | + // no endpoint found | |
2640 | + // set sorry flag on | |
2641 | + session_data->sorry_flag = SORRY_FLAG_ON; | |
2642 | + /*-------- DEBUG LOG --------*/ | |
2643 | + if (unlikely(LOG_LV_DEBUG == getloglevel())) { | |
2644 | + boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::" | |
2645 | + "handle_realserver_select() : SORRY_FLAG_ON. thread id : %d."); | |
2646 | + formatter % boost::this_thread::get_id(); | |
2647 | + putLogDebug(100076, formatter.str(), __FILE__, __LINE__); | |
2648 | + } | |
2649 | + /*------DEBUG LOG END------*/ | |
2650 | + status = SORRYSERVER_SELECT; | |
2651 | + } | |
2632 | 2652 | }else{ |
2633 | - // No endpoint matched keyword. | |
2634 | - //set end flag on | |
2635 | - session_data->sorry_flag = SORRY_FLAG_ON; | |
2636 | - /*-------- DEBUG LOG --------*/ | |
2637 | - if (unlikely(LOG_LV_DEBUG == getloglevel())) { | |
2638 | - boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::" | |
2639 | - "handle_realserver_select() : SORRY_FLAG_ON. thread id : %d."); | |
2640 | - formatter % boost::this_thread::get_id(); | |
2641 | - putLogDebug(100076, formatter.str(), __FILE__, __LINE__); | |
2642 | - } | |
2643 | - /*------DEBUG LOG END------*/ | |
2644 | - status = SORRYSERVER_SELECT; | |
2653 | + // client sends URL is no matched | |
2654 | + // set end flag on | |
2655 | + session_data->end_flag = END_FLAG_ON; | |
2656 | + /*-------- DEBUG LOG --------*/ | |
2657 | + if (unlikely(LOG_LV_DEBUG == getloglevel())) { | |
2658 | + boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::" | |
2659 | + "handle_realserver_select() : END_FLAG_ON. thread id : %d."); | |
2660 | + formatter % boost::this_thread::get_id(); | |
2661 | + putLogDebug(100229, formatter.str(), __FILE__, __LINE__); | |
2662 | + } | |
2663 | + /*------DEBUG LOG END------*/ | |
2664 | + status = FINALIZE; | |
2645 | 2665 | } |
2666 | + | |
2646 | 2667 | } |
2647 | - // URL Not found. | |
2668 | + // URL Not found | |
2648 | 2669 | else{ |
2649 | - session_data->sorry_flag = SORRY_FLAG_ON; | |
2650 | - /*-------- DEBUG LOG --------*/ | |
2651 | - if (unlikely(LOG_LV_DEBUG == getloglevel())) { | |
2652 | - boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::" | |
2653 | - "handle_realserver_select() : SORRY_FLAG_ON. thread id : %d."); | |
2654 | - formatter % boost::this_thread::get_id(); | |
2655 | - putLogDebug(100076, formatter.str(), __FILE__, __LINE__); | |
2656 | - } | |
2657 | - /*------DEBUG LOG END------*/ | |
2658 | - status = SORRYSERVER_SELECT; | |
2670 | + // set end flag on | |
2671 | + session_data->end_flag = END_FLAG_ON; | |
2672 | + /*-------- DEBUG LOG --------*/ | |
2673 | + if (unlikely(LOG_LV_DEBUG == getloglevel())) { | |
2674 | + boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::" | |
2675 | + "handle_realserver_select() : END_FLAG_ON. thread id : %d."); | |
2676 | + formatter % boost::this_thread::get_id(); | |
2677 | + putLogDebug(100229, formatter.str(), __FILE__, __LINE__); | |
2678 | + } | |
2679 | + /*------DEBUG LOG END------*/ | |
2680 | + status = FINALIZE; | |
2659 | 2681 | } |
2660 | 2682 | |
2661 | 2683 | } catch (int e) { |
@@ -7819,7 +7841,7 @@ std::list< realserver >::iterator protocol_module_url::next_rslist_it( std::list | ||
7819 | 7841 | return *rslist_it_list_it; |
7820 | 7842 | } |
7821 | 7843 | |
7822 | -//! @takeda:schedule_tcpを無理やり使うための関数.この方法はひどいと思うが他の方法がわからない... | |
7844 | +//! @takeda:schedule_tcpを無理やり使うための関数... | |
7823 | 7845 | //! @param[in] thread_id |
7824 | 7846 | //! @param[in] in_rslist_it_list : registered Real Servers ( This parameter is substantially 'const' in this function. ) |
7825 | 7847 | //! @param[out] rs_endpoint[out] : addressee Real Server |
@@ -7847,8 +7869,8 @@ void protocol_module_url::useScheduleTCP( | ||
7847 | 7869 | void protocol_module_url::dumpKeyary_endpointlist( int num ) |
7848 | 7870 | { |
7849 | 7871 | |
7850 | - pattern_endpoint_pairlist_it it = ptn_ep_pairlist.begin(); | |
7851 | - pattern_endpoint_pairlist_it it_end = ptn_ep_pairlist.end(); | |
7872 | + pattern_endpointlist_map_it it = ptn_eplist_map.begin(); | |
7873 | + pattern_endpointlist_map_it it_end = ptn_eplist_map.end(); | |
7852 | 7874 | |
7853 | 7875 | typedef std::list<boost::asio::ip::tcp::endpoint> eplist; |
7854 | 7876 |
@@ -7921,22 +7943,22 @@ void protocol_module_url::dumpOptionString( const std::vector<std::string>& args | ||
7921 | 7943 | |
7922 | 7944 | } |
7923 | 7945 | |
7924 | -void protocol_module_url::dumpKeyary_sregex_converter_map( void ) | |
7946 | +void protocol_module_url::dumpPtnsrgx_converter_pairlist( void ) | |
7925 | 7947 | { |
7926 | - putLogFatal(9999, "-------dumpKeyary_sregex_converter_map---------", __FILE__, __LINE__); | |
7927 | - | |
7928 | - std::string str; | |
7929 | - | |
7930 | - std::map< boost::array<char,MAX_OPTION_SIZE>, boost::xpressive::sregex >::iterator it = keyary_sregex_converter_map.begin(); | |
7931 | - std::map< boost::array<char,MAX_OPTION_SIZE>, boost::xpressive::sregex >::iterator end = keyary_sregex_converter_map.end(); | |
7932 | - | |
7933 | - while( it != end ){ | |
7934 | - str = it->first.data(); | |
7935 | - putLogFatal( 29290, "[ " + str + " ]", __FILE__, __LINE__ ); | |
7936 | - ++it; | |
7937 | - } | |
7938 | - | |
7939 | - putLogFatal(9999, "----------------------------------------------", __FILE__, __LINE__); | |
7948 | +// putLogFatal(9999, "-------dumpPtnsrgx_converter_pairlist---------", __FILE__, __LINE__); | |
7949 | +// | |
7950 | +// std::string str; | |
7951 | +// | |
7952 | +// std::map< boost::array<char,MAX_OPTION_SIZE>, boost::xpressive::sregex >::iterator it = keyary_sregex_converter_map.begin(); | |
7953 | +// std::map< boost::array<char,MAX_OPTION_SIZE>, boost::xpressive::sregex >::iterator end = keyary_sregex_converter_map.end(); | |
7954 | +// | |
7955 | +// while( it != end ){ | |
7956 | +// str = it->first.data(); | |
7957 | +// putLogFatal( 29290, "[ " + str + " ]", __FILE__, __LINE__ ); | |
7958 | +// ++it; | |
7959 | +// } | |
7960 | +// | |
7961 | +// putLogFatal(9999, "----------------------------------------------", __FILE__, __LINE__); | |
7940 | 7962 | } |
7941 | 7963 | |
7942 | 7964 | void protocol_module_url::testVolume( void ) |
@@ -128,12 +128,14 @@ protected: | ||
128 | 128 | std::map<boost::thread::id, thread_data_ptr> session_thread_data_map; |
129 | 129 | boost::mutex session_thread_data_map_mutex; |
130 | 130 | |
131 | - typedef std::pair< boost::array<char,MAX_OPTION_SIZE>, std::list<boost::asio::ip::tcp::endpoint> > pattern_endpoint_pair; | |
132 | - typedef std::list< pattern_endpoint_pair > pattern_endpoint_pairlist; | |
133 | - typedef std::list< pattern_endpoint_pair >::iterator pattern_endpoint_pairlist_it; | |
134 | - | |
135 | - pattern_endpoint_pairlist ptn_ep_pairlist; | |
136 | - std::map< boost::array<char,MAX_OPTION_SIZE>, boost::xpressive::sregex > keyary_sregex_converter_map; | |
131 | + typedef std::map< boost::array< char, MAX_OPTION_SIZE >, std::list< boost::asio::ip::tcp::endpoint > > pattern_endpointlist_map; | |
132 | + typedef std::map< boost::array< char, MAX_OPTION_SIZE >, std::list< boost::asio::ip::tcp::endpoint > >::iterator pattern_endpointlist_map_it; | |
133 | + pattern_endpointlist_map ptn_eplist_map; | |
134 | + // for keep order '-P/--pattern-match' option value set & convert pattern to sregex | |
135 | + typedef std::pair< boost::array< char, MAX_OPTION_SIZE >, boost::xpressive::sregex > pattern_sregex_converter_pair; | |
136 | + typedef std::list< pattern_sregex_converter_pair > pattern_sregex_converter_pairlist; | |
137 | + typedef std::list< pattern_sregex_converter_pair >::iterator pattern_sregex_converter_pairlist_it; | |
138 | + pattern_sregex_converter_pairlist ptnsrgx_converter_pairlist; | |
137 | 139 | |
138 | 140 | private: |
139 | 141 | template < class T >typename T::endpoint stringtoEndpoint( const std::string &str, error_code &err ); |
@@ -158,7 +160,7 @@ private: | ||
158 | 160 | void dumpKeyary_endpointlist( int num ); |
159 | 161 | void dumpRslist_it_list( void ); |
160 | 162 | void dumpOptionString( const std::vector<std::string>& args ); |
161 | - void dumpKeyary_sregex_converter_map( void ); | |
163 | + void dumpPtnsrgx_converter_pairlist( void ); | |
162 | 164 | void testVolume( void ); |
163 | 165 | public: |
164 | 166 | static const std::string MODULE_NAME; |