mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
pack 3 DatabaseLookup messages into one TunnelData while processing DatabaseSearchReply
This commit is contained in:
parent
093e566da6
commit
474aa9068a
7 changed files with 157 additions and 73 deletions
|
@ -175,31 +175,6 @@ namespace i2p
|
|||
}
|
||||
}
|
||||
|
||||
void HandleDatabaseSearchReplyMsg (uint8_t * buf, size_t len)
|
||||
{
|
||||
#pragma pack(1)
|
||||
struct
|
||||
{
|
||||
uint8_t key[32];
|
||||
uint8_t num;
|
||||
} * msg;
|
||||
#pragma pack()
|
||||
msg = (decltype(msg))buf;
|
||||
char key[48];
|
||||
int l = i2p::data::ByteStreamToBase64 (msg->key, 32, key, 48);
|
||||
key[l] = 0;
|
||||
LogPrint ("DatabaseSearchReply for ", key, " num=", (int)msg->num);
|
||||
for (int i = 0; i < msg->num; i++)
|
||||
{
|
||||
char peerHash[48];
|
||||
int l1 = i2p::data::ByteStreamToBase64 (buf + sizeof (*msg) +i*32, 32, peerHash, 48);
|
||||
peerHash[l1] = 0;
|
||||
LogPrint (i,": ", peerHash);
|
||||
|
||||
i2p::data::netdb.HandleDatabaseSearchReply (msg->key, buf + sizeof (*msg) +i*32);
|
||||
}
|
||||
}
|
||||
|
||||
I2NPBuildRequestRecordClearText CreateBuildRequestRecord (
|
||||
const uint8_t * ourIdent, uint32_t receiveTunnelID,
|
||||
const uint8_t * nextIdent, uint32_t nextTunnelID,
|
||||
|
@ -432,10 +407,6 @@ namespace i2p
|
|||
LogPrint ("Garlic");
|
||||
break;
|
||||
break;
|
||||
case eI2NPDatabaseSearchReply:
|
||||
LogPrint ("DatabaseSearchReply");
|
||||
HandleDatabaseSearchReplyMsg (buf, size);
|
||||
break;
|
||||
case eI2NPDeliveryStatus:
|
||||
LogPrint ("DeliveryStatus");
|
||||
break;
|
||||
|
@ -468,7 +439,11 @@ namespace i2p
|
|||
break;
|
||||
case eI2NPDatabaseStore:
|
||||
LogPrint ("DatabaseStore");
|
||||
i2p::data::netdb.PostDatabaseStoreMsg (msg);
|
||||
i2p::data::netdb.PostI2NPMsg (msg);
|
||||
break;
|
||||
case eI2NPDatabaseSearchReply:
|
||||
LogPrint ("DatabaseSearchReply");
|
||||
i2p::data::netdb.PostI2NPMsg (msg);
|
||||
break;
|
||||
default:
|
||||
HandleI2NPMessage (msg->GetBuffer (), msg->GetLength ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue