|
|
@ -650,6 +650,8 @@ namespace garlic |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// delivery status sessions
|
|
|
|
// delivery status sessions
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::unique_lock<std::mutex> l(m_DeliveryStatusSessionsMutex); |
|
|
|
for (auto it = m_DeliveryStatusSessions.begin (); it != m_DeliveryStatusSessions.end (); ) |
|
|
|
for (auto it = m_DeliveryStatusSessions.begin (); it != m_DeliveryStatusSessions.end (); ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it->second->GetOwner () != this) |
|
|
|
if (it->second->GetOwner () != this) |
|
|
@ -658,29 +660,38 @@ namespace garlic |
|
|
|
++it; |
|
|
|
++it; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GarlicDestination::RemoveDeliveryStatusSession (uint32_t msgID) |
|
|
|
void GarlicDestination::RemoveDeliveryStatusSession (uint32_t msgID) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
std::unique_lock<std::mutex> l(m_DeliveryStatusSessionsMutex); |
|
|
|
m_DeliveryStatusSessions.erase (msgID); |
|
|
|
m_DeliveryStatusSessions.erase (msgID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GarlicDestination::DeliveryStatusSent (GarlicRoutingSessionPtr session, uint32_t msgID) |
|
|
|
void GarlicDestination::DeliveryStatusSent (GarlicRoutingSessionPtr session, uint32_t msgID) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
std::unique_lock<std::mutex> l(m_DeliveryStatusSessionsMutex); |
|
|
|
m_DeliveryStatusSessions[msgID] = session; |
|
|
|
m_DeliveryStatusSessions[msgID] = session; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GarlicDestination::HandleDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
void GarlicDestination::HandleDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t msgID = bufbe32toh (msg->GetPayload ()); |
|
|
|
uint32_t msgID = bufbe32toh (msg->GetPayload ()); |
|
|
|
|
|
|
|
GarlicRoutingSessionPtr session; |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
std::unique_lock<std::mutex> l(m_DeliveryStatusSessionsMutex); |
|
|
|
auto it = m_DeliveryStatusSessions.find (msgID); |
|
|
|
auto it = m_DeliveryStatusSessions.find (msgID); |
|
|
|
if (it != m_DeliveryStatusSessions.end ()) |
|
|
|
if (it != m_DeliveryStatusSessions.end ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
it->second->MessageConfirmed (msgID); |
|
|
|
session = it->second; |
|
|
|
m_DeliveryStatusSessions.erase (it); |
|
|
|
m_DeliveryStatusSessions.erase (it); |
|
|
|
LogPrint (eLogDebug, "Garlic: message ", msgID, " acknowledged"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (session) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
session->MessageConfirmed (msgID); |
|
|
|
|
|
|
|
LogPrint (eLogDebug, "Garlic: message ", msgID, " acknowledged"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GarlicDestination::SetLeaseSetUpdated () |
|
|
|
void GarlicDestination::SetLeaseSetUpdated () |
|
|
|