mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-12 06:07:54 +00:00
lookup always takes full address from LeaseSet
This commit is contained in:
parent
be301dc090
commit
fbe4e64e44
30
BOB.cpp
30
BOB.cpp
@ -493,13 +493,35 @@ namespace client
|
||||
void BOBCommandSession::LookupCommandHandler (const char * operand, size_t len)
|
||||
{
|
||||
LogPrint (eLogDebug, "BOB: lookup ", operand);
|
||||
i2p::data::IdentityEx addr;
|
||||
if (!context.GetAddressBook ().GetAddress (operand, addr))
|
||||
i2p::data::IdentHash ident;
|
||||
if (!context.GetAddressBook ().GetIdentHash (operand, ident) && !m_CurrentDestination)
|
||||
{
|
||||
SendReplyError ("Address Not found");
|
||||
return;
|
||||
}
|
||||
SendReplyOK (addr.ToBase64 ().c_str ());
|
||||
}
|
||||
auto localDestination = m_CurrentDestination->GetLocalDestination ();
|
||||
auto leaseSet = localDestination->FindLeaseSet (ident);
|
||||
if (leaseSet)
|
||||
SendReplyOK (leaseSet->GetIdentity ().ToBase64 ().c_str ());
|
||||
else
|
||||
{
|
||||
auto s = shared_from_this ();
|
||||
m_CurrentDestination->GetLocalDestination ()->RequestDestination (ident,
|
||||
[s, ident, localDestination](bool success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
auto leaseSet = localDestination->FindLeaseSet (ident);
|
||||
if (leaseSet)
|
||||
s->SendReplyOK (leaseSet->GetIdentity ().ToBase64 ().c_str ());
|
||||
else
|
||||
s->SendReplyError ("Missing LeaseSet");
|
||||
}
|
||||
else
|
||||
s->SendReplyError ("LeaseSet Not found");
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void BOBCommandSession::ClearCommandHandler (const char * operand, size_t len)
|
||||
|
1
BOB.h
1
BOB.h
@ -127,6 +127,7 @@ namespace client
|
||||
void CreateInboundTunnel (int port);
|
||||
void CreateOutboundTunnel (const std::string& address, int port, bool quiet);
|
||||
const i2p::data::PrivateKeys& GetKeys () const { return m_LocalDestination->GetPrivateKeys (); };
|
||||
std::shared_ptr<ClientDestination> GetLocalDestination () const { return m_LocalDestination; };
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user