mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
fixed shared_ptr error
This commit is contained in:
parent
4317694c64
commit
2cbdb0bc17
13
Datagram.cpp
13
Datagram.cpp
|
@ -99,6 +99,8 @@ namespace datagram
|
||||||
size_t uncompressedLen = m_Inflator.Inflate (buf, len, uncompressed, MAX_DATAGRAM_SIZE);
|
size_t uncompressedLen = m_Inflator.Inflate (buf, len, uncompressed, MAX_DATAGRAM_SIZE);
|
||||||
if (uncompressedLen)
|
if (uncompressedLen)
|
||||||
HandleDatagram (fromPort, toPort, uncompressed, uncompressedLen);
|
HandleDatagram (fromPort, toPort, uncompressed, uncompressedLen);
|
||||||
|
else
|
||||||
|
LogPrint (eLogWarning, "Datagram: decompression failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<I2NPMessage> DatagramDestination::CreateDataMessage (const uint8_t * payload, size_t len, uint16_t fromPort, uint16_t toPort)
|
std::shared_ptr<I2NPMessage> DatagramDestination::CreateDataMessage (const uint8_t * payload, size_t len, uint16_t fromPort, uint16_t toPort)
|
||||||
|
@ -134,6 +136,7 @@ namespace datagram
|
||||||
if (now - it->second->LastActivity() >= DATAGRAM_SESSION_MAX_IDLE)
|
if (now - it->second->LastActivity() >= DATAGRAM_SESSION_MAX_IDLE)
|
||||||
{
|
{
|
||||||
LogPrint(eLogInfo, "DatagramDestination: expiring idle session with ", it->first.ToBase32());
|
LogPrint(eLogInfo, "DatagramDestination: expiring idle session with ", it->first.ToBase32());
|
||||||
|
it->second->Stop ();
|
||||||
it = m_Sessions.erase (it); // we are expired
|
it = m_Sessions.erase (it); // we are expired
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -149,6 +152,7 @@ namespace datagram
|
||||||
if (itr == m_Sessions.end()) {
|
if (itr == m_Sessions.end()) {
|
||||||
// not found, create new session
|
// not found, create new session
|
||||||
session = std::make_shared<DatagramSession>(m_Owner, identity);
|
session = std::make_shared<DatagramSession>(m_Owner, identity);
|
||||||
|
session->Start ();
|
||||||
m_Sessions[identity] = session;
|
m_Sessions[identity] = session;
|
||||||
} else {
|
} else {
|
||||||
session = itr->second;
|
session = itr->second;
|
||||||
|
@ -172,11 +176,20 @@ namespace datagram
|
||||||
m_RemoteIdent(remoteIdent),
|
m_RemoteIdent(remoteIdent),
|
||||||
m_SendQueueTimer(localDestination->GetService()),
|
m_SendQueueTimer(localDestination->GetService()),
|
||||||
m_RequestingLS(false)
|
m_RequestingLS(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatagramSession::Start ()
|
||||||
{
|
{
|
||||||
m_LastUse = i2p::util::GetMillisecondsSinceEpoch ();
|
m_LastUse = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
ScheduleFlushSendQueue();
|
ScheduleFlushSendQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatagramSession::Stop ()
|
||||||
|
{
|
||||||
|
m_SendQueueTimer.cancel ();
|
||||||
|
}
|
||||||
|
|
||||||
void DatagramSession::SendMsg(std::shared_ptr<I2NPMessage> msg)
|
void DatagramSession::SendMsg(std::shared_ptr<I2NPMessage> msg)
|
||||||
{
|
{
|
||||||
// we used this session
|
// we used this session
|
||||||
|
|
|
@ -37,8 +37,10 @@ namespace datagram
|
||||||
class DatagramSession : public std::enable_shared_from_this<DatagramSession>
|
class DatagramSession : public std::enable_shared_from_this<DatagramSession>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DatagramSession(i2p::client::ClientDestination * localDestination,
|
DatagramSession(i2p::client::ClientDestination * localDestination, const i2p::data::IdentHash & remoteIdent);
|
||||||
const i2p::data::IdentHash & remoteIdent);
|
|
||||||
|
void Start ();
|
||||||
|
void Stop ();
|
||||||
|
|
||||||
|
|
||||||
/** @brief ack the garlic routing path */
|
/** @brief ack the garlic routing path */
|
||||||
|
|
Loading…
Reference in a new issue