|
|
@ -495,21 +495,40 @@ namespace client |
|
|
|
else |
|
|
|
else |
|
|
|
m_BufferOffset = 0; |
|
|
|
m_BufferOffset = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<Address> addr; |
|
|
|
|
|
|
|
auto pos = destination.find(".b32.i2p"); |
|
|
|
|
|
|
|
if (pos != std::string::npos) |
|
|
|
|
|
|
|
addr = std::make_shared<Address>(destination.substr (0, pos)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
auto dest = std::make_shared<i2p::data::IdentityEx> (); |
|
|
|
auto dest = std::make_shared<i2p::data::IdentityEx> (); |
|
|
|
size_t l = dest->FromBase64(destination); |
|
|
|
size_t l = dest->FromBase64(destination); |
|
|
|
if (l > 0) |
|
|
|
if (l > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
context.GetAddressBook().InsertFullAddress(dest); |
|
|
|
context.GetAddressBook().InsertFullAddress(dest); |
|
|
|
auto leaseSet = session->localDestination->FindLeaseSet(dest->GetIdentHash()); |
|
|
|
addr = std::make_shared<Address>(dest->GetIdentHash ()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addr && addr->IsValid ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (addr->IsIdentHash ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
auto leaseSet = session->localDestination->FindLeaseSet(addr->identHash); |
|
|
|
if (leaseSet) |
|
|
|
if (leaseSet) |
|
|
|
Connect(leaseSet, session); |
|
|
|
Connect(leaseSet, session); |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
session->localDestination->RequestDestination(dest->GetIdentHash(), |
|
|
|
session->localDestination->RequestDestination(addr->identHash, |
|
|
|
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete, |
|
|
|
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete, |
|
|
|
shared_from_this(), std::placeholders::_1)); |
|
|
|
shared_from_this(), std::placeholders::_1)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else // B33
|
|
|
|
|
|
|
|
session->localDestination->RequestDestinationWithEncryptedLeaseSet (addr->blindedPublicKey, |
|
|
|
|
|
|
|
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete, |
|
|
|
|
|
|
|
shared_from_this(), std::placeholders::_1)); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
SendMessageReply (SAM_STREAM_STATUS_INVALID_KEY, strlen(SAM_STREAM_STATUS_INVALID_KEY), true); |
|
|
|
SendMessageReply (SAM_STREAM_STATUS_INVALID_KEY, strlen(SAM_STREAM_STATUS_INVALID_KEY), true); |
|
|
|
} |
|
|
|
} |
|
|
|