MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / DestLookupMessageHandler

Method DestLookupMessageHandler

libi2pd_client/I2CP.cpp:1040–1075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1038 }
1039
1040 void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t len)
1041 {
1042 if (m_Destination)
1043 {
1044 auto ls = m_Destination->FindLeaseSet (buf);
1045 if (ls)
1046 {
1047 auto l = ls->GetIdentity ()->GetFullLen ();
1048 uint8_t * identBuf = new uint8_t[l];
1049 ls->GetIdentity ()->ToBuffer (identBuf, l);
1050 SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, identBuf, l);
1051 delete[] identBuf;
1052 }
1053 else
1054 {
1055 auto s = shared_from_this ();
1056 i2p::data::IdentHash ident (buf);
1057 m_Destination->RequestDestination (ident,
1058 [s, ident](std::shared_ptr<i2p::data::LeaseSet> leaseSet)
1059 {
1060 if (leaseSet) // found
1061 {
1062 auto l = leaseSet->GetIdentity ()->GetFullLen ();
1063 uint8_t * identBuf = new uint8_t[l];
1064 leaseSet->GetIdentity ()->ToBuffer (identBuf, l);
1065 s->SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, identBuf, l);
1066 delete[] identBuf;
1067 }
1068 else
1069 s->SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, ident, 32); // not found
1070 });
1071 }
1072 }
1073 else
1074 SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, buf, 32);
1075 }
1076
1077 void I2CPSession::GetBandwidthLimitsMessageHandler (const uint8_t * buf, size_t len)
1078 {

Callers

nothing calls this directly

Calls 6

SendI2CPMessageMethod · 0.80
FindLeaseSetMethod · 0.45
GetFullLenMethod · 0.45
GetIdentityMethod · 0.45
ToBufferMethod · 0.45
RequestDestinationMethod · 0.45

Tested by

no test coverage detected