Browse Source

fixed possible crash at shutdown

pull/2094/merge
orignal 4 days ago
parent
commit
7497741846
  1. 2
      libi2pd/NTCP2.cpp
  2. 4
      libi2pd/Tunnel.h

2
libi2pd/NTCP2.cpp

@ -1550,6 +1550,7 @@ namespace transport
void NTCP2Server::Stop () void NTCP2Server::Stop ()
{ {
m_EstablisherService.Stop ();
{ {
// we have to copy it because Terminate changes m_NTCP2Sessions // we have to copy it because Terminate changes m_NTCP2Sessions
auto ntcpSessions = m_NTCP2Sessions; auto ntcpSessions = m_NTCP2Sessions;
@ -1565,7 +1566,6 @@ namespace transport
m_TerminationTimer.cancel (); m_TerminationTimer.cancel ();
m_ProxyEndpoint = nullptr; m_ProxyEndpoint = nullptr;
} }
m_EstablisherService.Stop ();
StopIOService (); StopIOService ();
} }

4
libi2pd/Tunnel.h

@ -296,6 +296,8 @@ namespace tunnel
bool m_IsRunning; bool m_IsRunning;
std::thread * m_Thread; std::thread * m_Thread;
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool;
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool;
std::map<uint32_t, std::shared_ptr<InboundTunnel> > m_PendingInboundTunnels; // by replyMsgID std::map<uint32_t, std::shared_ptr<InboundTunnel> > m_PendingInboundTunnels; // by replyMsgID
std::map<uint32_t, std::shared_ptr<OutboundTunnel> > m_PendingOutboundTunnels; // by replyMsgID std::map<uint32_t, std::shared_ptr<OutboundTunnel> > m_PendingOutboundTunnels; // by replyMsgID
std::list<std::shared_ptr<InboundTunnel> > m_InboundTunnels; std::list<std::shared_ptr<InboundTunnel> > m_InboundTunnels;
@ -306,8 +308,6 @@ namespace tunnel
std::list<std::shared_ptr<TunnelPool>> m_Pools; std::list<std::shared_ptr<TunnelPool>> m_Pools;
std::shared_ptr<TunnelPool> m_ExploratoryPool; std::shared_ptr<TunnelPool> m_ExploratoryPool;
i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_Queue; i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_Queue;
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool;
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool;
uint32_t m_MaxNumTransitTunnels; uint32_t m_MaxNumTransitTunnels;
// count of tunnels for total TCSR algorithm // count of tunnels for total TCSR algorithm
int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations; int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations;

Loading…
Cancel
Save