Skip to content

Commit

Permalink
fix NetSvrManager lock bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchao412 committed Mar 27, 2024
1 parent fa690ed commit c3d5c33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions PSS_ASIO/Common/NetSvrManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CNetSvrManager::~CNetSvrManager()

void CNetSvrManager::start_default_service()
{
std::lock_guard <std::mutex> lock(list_mutex_);
std::lock_guard <std::recursive_mutex> lock(list_mutex_);
string stripport;

//加载Tcp监听
Expand Down Expand Up @@ -98,7 +98,7 @@ void CNetSvrManager::close_all_service()
{
PSS_LOGGER_DEBUG("[CNetSvrManager::close_all_service]begin.");

std::lock_guard <std::mutex> lock(list_mutex_);
std::lock_guard <std::recursive_mutex> lock(list_mutex_);
std::vector<shared_ptr<CIo_Net_server>> tcp_listen_list;
std::vector<shared_ptr<CIo_Net_server>> tcp_listen_ssl_list;
std::vector<shared_ptr<CIo_Net_server>> udp_listen_list;
Expand Down Expand Up @@ -160,7 +160,7 @@ void CNetSvrManager::close_all_service()

void CNetSvrManager::add_accept_net_io_event(string io_ip, io_port_type io_port, EM_CONNECT_IO_TYPE em_io_net_type, shared_ptr<CIo_Net_server> Io_Net_server)
{
std::lock_guard <std::mutex> lock(list_mutex_);
std::lock_guard <std::recursive_mutex> lock(list_mutex_);
auto io_key = io_ip + "_" + std::to_string(io_port);
if (EM_CONNECT_IO_TYPE::CONNECT_IO_TCP == em_io_net_type)
{
Expand All @@ -182,7 +182,7 @@ void CNetSvrManager::add_accept_net_io_event(string io_ip, io_port_type io_port,

void CNetSvrManager::del_accept_net_io_event(string io_ip, io_port_type io_port, EM_CONNECT_IO_TYPE em_io_net_type)
{
std::lock_guard <std::mutex> lock(list_mutex_);
std::lock_guard <std::recursive_mutex> lock(list_mutex_);
auto io_key = io_ip + "_" + std::to_string(io_port);
if (EM_CONNECT_IO_TYPE::CONNECT_IO_TCP == em_io_net_type)
{
Expand Down
2 changes: 1 addition & 1 deletion PSS_ASIO/Common/NetSvrManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CNetSvrManager : public CIo_List_Manager
hashipport2tcpsslserver tcp_ssl_service_map_;
#endif

std::mutex list_mutex_;
std::recursive_mutex list_mutex_;
};

using App_NetSvrManager = PSS_singleton<CNetSvrManager>;

0 comments on commit c3d5c33

Please sign in to comment.