mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
fix sam crash on exit and datagram crash with no outbound tunnel
This commit is contained in:
parent
042adb5e34
commit
965896b932
3 changed files with 13 additions and 18 deletions
28
SAM.cpp
28
SAM.cpp
|
@ -710,11 +710,6 @@ namespace client
|
|||
{
|
||||
PumpBacklog();
|
||||
}
|
||||
|
||||
SAMSession::~SAMSession ()
|
||||
{
|
||||
i2p::client::context.DeleteLocalDestination (localDestination);
|
||||
}
|
||||
|
||||
void SAMSession::AcceptI2P(std::shared_ptr<i2p::stream::Stream> stream)
|
||||
{
|
||||
|
@ -767,18 +762,19 @@ namespace client
|
|||
|
||||
void SAMSession::CloseStreams ()
|
||||
{
|
||||
m_BacklogPumper.cancel();
|
||||
localDestination->GetService().post([&] () {
|
||||
std::lock_guard<std::mutex> lock(m_SocketsMutex);
|
||||
for (auto& sock : m_Sockets) {
|
||||
sock->CloseStream();
|
||||
}
|
||||
for(auto & stream : m_Backlog) {
|
||||
stream->Close();
|
||||
}
|
||||
// XXX: should this be done inside locked parts?
|
||||
m_Sockets.clear();
|
||||
m_Backlog.clear();
|
||||
});
|
||||
std::lock_guard<std::mutex> lock(m_SocketsMutex);
|
||||
for (auto& sock : m_Sockets) {
|
||||
sock->CloseStream();
|
||||
}
|
||||
for(auto & stream : m_Backlog) {
|
||||
stream->Close();
|
||||
}
|
||||
m_Sockets.clear();
|
||||
m_Backlog.clear();
|
||||
i2p::client::context.DeleteLocalDestination (localDestination);
|
||||
});
|
||||
}
|
||||
|
||||
SAMBridge::SAMBridge (const std::string& address, int port):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue