UltraMonkey-L7 V3(multi-thread implementation)
Révision | 044fa25a81913ff0c62ee26f6a8ed68a38090055 (tree) |
---|---|
l'heure | 2014-02-24 15:01:20 |
Auteur | Michiro Hibari <l05102@shib...> |
Commiter | Michiro Hibari |
fix ticket #33102 (fix memory reak).
@@ -621,6 +621,8 @@ public: | ||
621 | 621 | void run(); |
622 | 622 | void stop(); |
623 | 623 | |
624 | + boost::shared_ptr<boost::thread> vs_thread_ptr; | |
625 | + | |
624 | 626 | void connection_active(const boost::asio::ip::tcp::endpoint &); |
625 | 627 | void connection_inactive(const boost::asio::ip::tcp::endpoint &); |
626 | 628 | void release_session(const tcp_session *session_ptr); |
@@ -249,7 +249,7 @@ void l7vsd::add_virtual_service(const virtualservice_element *in_vselement, e | ||
249 | 249 | try { |
250 | 250 | |
251 | 251 | // create thread and run |
252 | - vs_threads.create_thread(boost::bind(&virtual_service::run, vsptr)); | |
252 | + (*vsptr).vs_thread_ptr = boost::shared_ptr<boost::thread>(vs_threads.create_thread(boost::bind(&virtual_service::run, vsptr))); | |
253 | 253 | |
254 | 254 | } catch (...) { |
255 | 255 | std::stringstream buf; |
@@ -348,6 +348,8 @@ void l7vsd::del_virtual_service(const virtualservice_element *in_vselement, e | ||
348 | 348 | if (vslist.end() != vsitr) { |
349 | 349 | // vs stop |
350 | 350 | (*vsitr)->stop(); |
351 | + (*vsitr)->vs_thread_ptr->join(); | |
352 | + vs_threads.remove_thread((*vsitr)->vs_thread_ptr.get()); | |
351 | 353 | // vs finalize |
352 | 354 | (*vsitr)->finalize(err); |
353 | 355 |