Browse Source

lookup always takes full address from LeaseSet

pull/177/head
orignal 10 years ago
parent
commit
fbe4e64e44
  1. 28
      BOB.cpp
  2. 1
      BOB.h

28
BOB.cpp

@ -493,13 +493,35 @@ namespace client
void BOBCommandSession::LookupCommandHandler (const char * operand, size_t len) void BOBCommandSession::LookupCommandHandler (const char * operand, size_t len)
{ {
LogPrint (eLogDebug, "BOB: lookup ", operand); LogPrint (eLogDebug, "BOB: lookup ", operand);
i2p::data::IdentityEx addr; i2p::data::IdentHash ident;
if (!context.GetAddressBook ().GetAddress (operand, addr)) if (!context.GetAddressBook ().GetIdentHash (operand, ident) && !m_CurrentDestination)
{ {
SendReplyError ("Address Not found"); SendReplyError ("Address Not found");
return; 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) void BOBCommandSession::ClearCommandHandler (const char * operand, size_t len)

1
BOB.h

@ -127,6 +127,7 @@ namespace client
void CreateInboundTunnel (int port); void CreateInboundTunnel (int port);
void CreateOutboundTunnel (const std::string& address, int port, bool quiet); void CreateOutboundTunnel (const std::string& address, int port, bool quiet);
const i2p::data::PrivateKeys& GetKeys () const { return m_LocalDestination->GetPrivateKeys (); }; const i2p::data::PrivateKeys& GetKeys () const { return m_LocalDestination->GetPrivateKeys (); };
std::shared_ptr<ClientDestination> GetLocalDestination () const { return m_LocalDestination; };
private: private:

Loading…
Cancel
Save