UltraMonkey-L7 V3(multi-thread implementation)
Revision | 6f2218216860555ecf2243cdc51758a0e9a2f614 (tree) |
---|---|
Time | 2013-06-13 15:37:58 |
Author | Hiroaki Nakano <nakano.hiroaki@nttc...> |
Commiter | Hiroaki Nakano |
Merge branch 'remain_thread_fix' into v3.1.0-devel
@@ -451,6 +451,8 @@ protected: | ||
451 | 451 | session_map_type active_sessions; |
452 | 452 | l7vs::atomic<unsigned long long> |
453 | 453 | active_count; |
454 | + session_thread_control *waiting_stc; | |
455 | + //! session_thread_control waiting accept | |
454 | 456 | |
455 | 457 | bool defer_accept_opt; |
456 | 458 | //! is set option TCP_DEFER_ACCEPT |
@@ -432,6 +432,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control | ||
432 | 432 | stc_ptr_noconst->session_access_log_output_mode_change(access_log_flag); |
433 | 433 | |
434 | 434 | active_sessions.insert(tmp_session, stc_ptr_noconst); |
435 | + waiting_stc = NULL; | |
435 | 436 | |
436 | 437 | //check sorry flag and status |
437 | 438 | if (unlikely( |
@@ -502,6 +503,7 @@ void l7vs::virtualservice_tcp::handle_accept(const l7vs::session_thread_control | ||
502 | 503 | boost::mutex::scoped_lock down_wait_lk(stc_ptr_register_accept->get_downthread_mutex()); |
503 | 504 | |
504 | 505 | waiting_session = stc_ptr_register_accept->get_session().get(); |
506 | + waiting_stc = stc_ptr_register_accept; | |
505 | 507 | |
506 | 508 | if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) { |
507 | 509 | boost::format fmt1("active session thread id = %d"); |
@@ -920,7 +922,7 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err) | ||
920 | 922 | delete stc; |
921 | 923 | stc = NULL; |
922 | 924 | if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_VIRTUALSERVICE))) { |
923 | - boost::format fmt("join pool session: pool_sessions.size = %d"); | |
925 | + boost::format fmt("join pool session: pool_session.size = %d"); | |
924 | 926 | fmt % pool_sessions.size(); |
925 | 927 | Logger::putLogDebug(LOG_CAT_L7VSD_VIRTUALSERVICE, 55, fmt.str(), |
926 | 928 | __FILE__, __LINE__); |
@@ -930,6 +932,9 @@ void l7vs::virtualservice_tcp::finalize(l7vs::error_code &err) | ||
930 | 932 | delete waiting_session; |
931 | 933 | waiting_session = NULL; |
932 | 934 | |
935 | + //waiting thread delete | |
936 | + waiting_stc->join(); | |
937 | + | |
933 | 938 | //unload ProtocolModule |
934 | 939 | if (protomod) { |
935 | 940 | //finalize ProtocolModule |
@@ -1597,6 +1602,7 @@ void l7vs::virtualservice_tcp::run() | ||
1597 | 1602 | } while (!stc_ptr); |
1598 | 1603 | |
1599 | 1604 | waiting_session = stc_ptr->get_session().get(); |
1605 | + waiting_stc = stc_ptr; | |
1600 | 1606 | |
1601 | 1607 | if (!ssl_virtualservice_mode_flag) { |
1602 | 1608 | acceptor_->async_accept(waiting_session->get_client_socket().get_socket(), |