Browse Source

shared_ptr for streaming destination

pull/163/head
orignal 10 years ago
parent
commit
45cb98c8de
  1. 4
      Destination.cpp
  2. 4
      Destination.h

4
Destination.cpp

@ -48,7 +48,7 @@ namespace client @@ -48,7 +48,7 @@ namespace client
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this, inboundTunnelLen, outboundTunnelLen);
if (m_IsPublic)
LogPrint (eLogInfo, "Local address ", i2p::client::GetB32Address(GetIdentHash()), " created");
m_StreamingDestination = new i2p::stream::StreamingDestination (*this); // TODO:
m_StreamingDestination = std::make_shared<i2p::stream::StreamingDestination> (*this); // TODO:
}
ClientDestination::~ClientDestination ()
@ -59,8 +59,6 @@ namespace client @@ -59,8 +59,6 @@ namespace client
delete it.second;
if (m_Pool)
i2p::tunnel::tunnels.DeleteTunnelPool (m_Pool);
if (m_StreamingDestination)
delete m_StreamingDestination;
if (m_DatagramDestination)
delete m_DatagramDestination;
}

4
Destination.h

@ -68,7 +68,7 @@ namespace client @@ -68,7 +68,7 @@ namespace client
bool RequestDestination (const i2p::data::IdentHash& dest, RequestComplete requestComplete = nullptr);
// streaming
i2p::stream::StreamingDestination * GetStreamingDestination () const { return m_StreamingDestination; };
std::shared_ptr<i2p::stream::StreamingDestination> GetStreamingDestination () const { return m_StreamingDestination; };
void CreateStream (StreamRequestComplete streamRequestComplete, const i2p::data::IdentHash& dest, int port = 0);
std::shared_ptr<i2p::stream::Stream> CreateStream (std::shared_ptr<const i2p::data::LeaseSet> remote, int port = 0);
void AcceptStreams (const i2p::stream::StreamingDestination::Acceptor& acceptor);
@ -130,7 +130,7 @@ namespace client @@ -130,7 +130,7 @@ namespace client
uint32_t m_PublishReplyToken;
std::set<i2p::data::IdentHash> m_ExcludedFloodfills; // for publishing
i2p::stream::StreamingDestination * m_StreamingDestination;
std::shared_ptr<i2p::stream::StreamingDestination> m_StreamingDestination;
i2p::datagram::DatagramDestination * m_DatagramDestination;
boost::asio::deadline_timer m_PublishConfirmationTimer, m_CleanupTimer;

Loading…
Cancel
Save