mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
don't try to connect though teminated local destination
This commit is contained in:
parent
31494267e5
commit
951ec567c7
|
@ -494,7 +494,7 @@ namespace client
|
|||
context.GetAddressBook().InsertFullAddress(dest);
|
||||
auto leaseSet = session->localDestination->FindLeaseSet(dest->GetIdentHash());
|
||||
if (leaseSet)
|
||||
Connect(leaseSet);
|
||||
Connect(leaseSet, session);
|
||||
else
|
||||
{
|
||||
session->localDestination->RequestDestination(dest->GetIdentHash(),
|
||||
|
@ -509,18 +509,25 @@ namespace client
|
|||
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true);
|
||||
}
|
||||
|
||||
void SAMSocket::Connect (std::shared_ptr<const i2p::data::LeaseSet> remote)
|
||||
void SAMSocket::Connect (std::shared_ptr<const i2p::data::LeaseSet> remote, std::shared_ptr<SAMSession> session)
|
||||
{
|
||||
auto session = m_Owner.FindSession(m_ID);
|
||||
if(session)
|
||||
if (!session) session = m_Owner.FindSession(m_ID);
|
||||
if (session)
|
||||
{
|
||||
m_SocketType = eSAMSocketTypeStream;
|
||||
m_Stream = session->localDestination->CreateStream (remote);
|
||||
if (m_Stream)
|
||||
{
|
||||
m_Stream->Send ((uint8_t *)m_Buffer, m_BufferOffset); // connect and send
|
||||
m_BufferOffset = 0;
|
||||
I2PReceive ();
|
||||
SendMessageReply (SAM_STREAM_STATUS_OK, strlen(SAM_STREAM_STATUS_OK), false);
|
||||
}
|
||||
else
|
||||
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true);
|
||||
}
|
||||
else
|
||||
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true);
|
||||
}
|
||||
|
||||
void SAMSocket::HandleConnectLeaseSetRequestComplete (std::shared_ptr<i2p::data::LeaseSet> leaseSet)
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace client
|
|||
size_t ProcessDatagramSend (char * buf, size_t len, const char * data); // from SAM 1.0
|
||||
void ExtractParams (char * buf, std::map<std::string, std::string>& params);
|
||||
|
||||
void Connect (std::shared_ptr<const i2p::data::LeaseSet> remote);
|
||||
void Connect (std::shared_ptr<const i2p::data::LeaseSet> remote, std::shared_ptr<SAMSession> session = nullptr);
|
||||
void HandleConnectLeaseSetRequestComplete (std::shared_ptr<i2p::data::LeaseSet> leaseSet);
|
||||
void SendNamingLookupReply (std::shared_ptr<const i2p::data::IdentityEx> identity);
|
||||
void HandleNamingLookupLeaseSetRequestComplete (std::shared_ptr<i2p::data::LeaseSet> leaseSet, std::string name);
|
||||
|
|
Loading…
Reference in a new issue