Skip to content

Commit

Permalink
fixed termination deadlock if SAM session is active
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jan 23, 2025
1 parent 1e7254d commit 4fa5cec
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libi2pd_client/SAM.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2024, The PurpleI2P Project
* Copyright (c) 2013-2025, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
Expand Down Expand Up @@ -1350,12 +1350,14 @@ namespace client
LogPrint (eLogError, "SAM: Runtime exception: ", ex.what ());
}

decltype(m_Sessions) sessions;
{
std::unique_lock<std::mutex> l(m_SessionsMutex);
for (auto& it: m_Sessions)
it.second->Close ();
m_Sessions.clear ();
}
m_Sessions.swap (sessions);
}
for (auto& it: sessions)
it.second->Close ();

StopIOService ();
}

Expand Down

0 comments on commit 4fa5cec

Please sign in to comment.