|
|
@ -494,7 +494,7 @@ namespace client |
|
|
|
context.GetAddressBook().InsertFullAddress(dest); |
|
|
|
context.GetAddressBook().InsertFullAddress(dest); |
|
|
|
auto leaseSet = session->localDestination->FindLeaseSet(dest->GetIdentHash()); |
|
|
|
auto leaseSet = session->localDestination->FindLeaseSet(dest->GetIdentHash()); |
|
|
|
if (leaseSet) |
|
|
|
if (leaseSet) |
|
|
|
Connect(leaseSet); |
|
|
|
Connect(leaseSet, session); |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
session->localDestination->RequestDestination(dest->GetIdentHash(), |
|
|
|
session->localDestination->RequestDestination(dest->GetIdentHash(), |
|
|
@ -509,18 +509,25 @@ namespace client |
|
|
|
SendMessageReply (SAM_STREAM_STATUS_INVALID_ID, strlen(SAM_STREAM_STATUS_INVALID_ID), true); |
|
|
|
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) session = m_Owner.FindSession(m_ID); |
|
|
|
if(session) |
|
|
|
if (session) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_SocketType = eSAMSocketTypeStream; |
|
|
|
m_SocketType = eSAMSocketTypeStream; |
|
|
|
m_Stream = session->localDestination->CreateStream (remote); |
|
|
|
m_Stream = session->localDestination->CreateStream (remote); |
|
|
|
m_Stream->Send ((uint8_t *)m_Buffer, m_BufferOffset); // connect and send
|
|
|
|
if (m_Stream) |
|
|
|
m_BufferOffset = 0; |
|
|
|
{ |
|
|
|
I2PReceive (); |
|
|
|
m_Stream->Send ((uint8_t *)m_Buffer, m_BufferOffset); // connect and send
|
|
|
|
SendMessageReply (SAM_STREAM_STATUS_OK, strlen(SAM_STREAM_STATUS_OK), false); |
|
|
|
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) |
|
|
|
void SAMSocket::HandleConnectLeaseSetRequestComplete (std::shared_ptr<i2p::data::LeaseSet> leaseSet) |
|
|
|