1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-02-02 06:54:15 +00:00

send DatabaseStore reply

This commit is contained in:
orignal 2015-01-30 15:13:09 -05:00
parent 0b911a5caa
commit 79af7c22d9

View File

@ -473,7 +473,28 @@ namespace data
uint32_t replyToken = bufbe32toh (buf + DATABASE_STORE_REPLY_TOKEN_OFFSET); uint32_t replyToken = bufbe32toh (buf + DATABASE_STORE_REPLY_TOKEN_OFFSET);
size_t offset = DATABASE_STORE_HEADER_SIZE; size_t offset = DATABASE_STORE_HEADER_SIZE;
if (replyToken) if (replyToken)
offset += 36; {
auto deliveryStatus = CreateDeliveryStatusMsg (replyToken);
offset += 4;
uint32_t tunnelID = bufbe32toh (buf + offset);
offset += 32;
if (!tunnelID) // send response directly
transports.SendMessage (buf + offset, deliveryStatus);
else
{
auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
auto outbound = pool ? pool->GetNextOutboundTunnel () : nullptr;
if (outbound)
outbound->SendTunnelDataMsg (buf + offset, tunnelID, deliveryStatus);
else
{
LogPrint (eLogError, "No outbound tunnels for DatabaseStore reply found");
DeleteI2NPMessage (deliveryStatus);
}
}
// TODO: flood in case of floodfill. replyToken must be set to zero
}
if (buf[DATABASE_STORE_TYPE_OFFSET]) // type if (buf[DATABASE_STORE_TYPE_OFFSET]) // type
{ {
LogPrint ("LeaseSet"); LogPrint ("LeaseSet");