Skip to content

Commit

Permalink
fix udp dead lock logic
Browse files Browse the repository at this point in the history
  • Loading branch information
freeeyes committed Mar 25, 2024
1 parent a9a36a3 commit 69ca8ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion PSS_ASIO/UdpSession/UdpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ void CUdpServer::close_udp_endpoint_by_id(uint32 connect_id)
}

_ClientIPInfo remote_ip;
bool is_find = false;

udp_session_mutex_.lock();
auto f = udp_id_2_endpoint_list_.find(connect_id);
if (f != udp_id_2_endpoint_list_.end())
{
Expand All @@ -454,7 +456,7 @@ void CUdpServer::close_udp_endpoint_by_id(uint32 connect_id)
remote_ip.m_strClientIP = f->second->send_endpoint.address().to_string();
remote_ip.m_u2Port = f->second->send_endpoint.port();

App_WorkThreadLogic::instance()->delete_thread_session(connect_id, self, remote_ip, io_type_);
is_find = true;

//清理链接关系
auto session_endpoint = f->second->send_endpoint;
Expand All @@ -467,6 +469,12 @@ void CUdpServer::close_udp_endpoint_by_id(uint32 connect_id)
{
cid_recv_data_time_.erase(iter);
}
udp_session_mutex_.unlock();

if (is_find == true)
{
App_WorkThreadLogic::instance()->delete_thread_session(connect_id, self, remote_ip, io_type_);
}
}

void CUdpServer::add_send_finish_size(uint32 connect_id, size_t length)
Expand Down

0 comments on commit 69ca8ea

Please sign in to comment.