mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 12:24:19 +00:00
fix sam crash on exit and datagram crash with no outbound tunnel
This commit is contained in:
parent
d5f27ecb0e
commit
673b7a95b7
@ -310,7 +310,7 @@ namespace datagram
|
|||||||
std::vector<i2p::tunnel::TunnelMessageBlock> send;
|
std::vector<i2p::tunnel::TunnelMessageBlock> send;
|
||||||
auto routingPath = GetSharedRoutingPath();
|
auto routingPath = GetSharedRoutingPath();
|
||||||
// if we don't have a routing path we will drop all queued messages
|
// if we don't have a routing path we will drop all queued messages
|
||||||
if(routingPath)
|
if(routingPath && routingPath->outboundTunnel && routingPath->remoteLease)
|
||||||
{
|
{
|
||||||
for (const auto & msg : m_SendQueue)
|
for (const auto & msg : m_SendQueue)
|
||||||
{
|
{
|
||||||
|
8
SAM.cpp
8
SAM.cpp
@ -711,11 +711,6 @@ namespace client
|
|||||||
PumpBacklog();
|
PumpBacklog();
|
||||||
}
|
}
|
||||||
|
|
||||||
SAMSession::~SAMSession ()
|
|
||||||
{
|
|
||||||
i2p::client::context.DeleteLocalDestination (localDestination);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAMSession::AcceptI2P(std::shared_ptr<i2p::stream::Stream> stream)
|
void SAMSession::AcceptI2P(std::shared_ptr<i2p::stream::Stream> stream)
|
||||||
{
|
{
|
||||||
if(!stream) return; // fail
|
if(!stream) return; // fail
|
||||||
@ -767,6 +762,7 @@ namespace client
|
|||||||
|
|
||||||
void SAMSession::CloseStreams ()
|
void SAMSession::CloseStreams ()
|
||||||
{
|
{
|
||||||
|
m_BacklogPumper.cancel();
|
||||||
localDestination->GetService().post([&] () {
|
localDestination->GetService().post([&] () {
|
||||||
std::lock_guard<std::mutex> lock(m_SocketsMutex);
|
std::lock_guard<std::mutex> lock(m_SocketsMutex);
|
||||||
for (auto& sock : m_Sockets) {
|
for (auto& sock : m_Sockets) {
|
||||||
@ -775,9 +771,9 @@ namespace client
|
|||||||
for(auto & stream : m_Backlog) {
|
for(auto & stream : m_Backlog) {
|
||||||
stream->Close();
|
stream->Close();
|
||||||
}
|
}
|
||||||
// XXX: should this be done inside locked parts?
|
|
||||||
m_Sockets.clear();
|
m_Sockets.clear();
|
||||||
m_Backlog.clear();
|
m_Backlog.clear();
|
||||||
|
i2p::client::context.DeleteLocalDestination (localDestination);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
SAM.h
1
SAM.h
@ -165,7 +165,6 @@ namespace client
|
|||||||
}
|
}
|
||||||
|
|
||||||
SAMSession (std::shared_ptr<ClientDestination> dest);
|
SAMSession (std::shared_ptr<ClientDestination> dest);
|
||||||
~SAMSession ();
|
|
||||||
|
|
||||||
void AcceptI2P(std::shared_ptr<i2p::stream::Stream> stream);
|
void AcceptI2P(std::shared_ptr<i2p::stream::Stream> stream);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user