mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
invoke accepter after receiving remote identity
This commit is contained in:
parent
583838e2c2
commit
cbfe8b8232
@ -162,7 +162,10 @@ namespace stream
|
|||||||
optionData += m_RemoteIdentity.FromBuffer (optionData, packet->GetOptionSize ());
|
optionData += m_RemoteIdentity.FromBuffer (optionData, packet->GetOptionSize ());
|
||||||
LogPrint (eLogInfo, "From identity ", m_RemoteIdentity.GetIdentHash ().ToBase64 ());
|
LogPrint (eLogInfo, "From identity ", m_RemoteIdentity.GetIdentHash ().ToBase64 ());
|
||||||
if (!m_RemoteLeaseSet)
|
if (!m_RemoteLeaseSet)
|
||||||
|
{
|
||||||
LogPrint (eLogDebug, "Incoming stream from ", m_RemoteIdentity.GetIdentHash ().ToBase64 ());
|
LogPrint (eLogDebug, "Incoming stream from ", m_RemoteIdentity.GetIdentHash ().ToBase64 ());
|
||||||
|
m_LocalDestination.StreamAccepted (shared_from_this ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & PACKET_FLAG_MAX_PACKET_SIZE_INCLUDED)
|
if (flags & PACKET_FLAG_MAX_PACKET_SIZE_INCLUDED)
|
||||||
@ -642,6 +645,17 @@ namespace stream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StreamingDestination::StreamAccepted (std::shared_ptr<Stream> stream)
|
||||||
|
{
|
||||||
|
if (m_Acceptor != nullptr)
|
||||||
|
m_Acceptor (stream);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint ("Acceptor for incoming stream is not set");
|
||||||
|
DeleteStream (stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StreamingDestination::HandleNextPacket (Packet * packet)
|
void StreamingDestination::HandleNextPacket (Packet * packet)
|
||||||
{
|
{
|
||||||
uint32_t sendStreamID = packet->GetSendStreamID ();
|
uint32_t sendStreamID = packet->GetSendStreamID ();
|
||||||
@ -660,13 +674,6 @@ namespace stream
|
|||||||
{
|
{
|
||||||
auto incomingStream = CreateNewIncomingStream ();
|
auto incomingStream = CreateNewIncomingStream ();
|
||||||
incomingStream->HandleNextPacket (packet);
|
incomingStream->HandleNextPacket (packet);
|
||||||
if (m_Acceptor != nullptr)
|
|
||||||
m_Acceptor (incomingStream);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogPrint ("Acceptor for incoming stream is not set");
|
|
||||||
DeleteStream (incomingStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,6 +170,7 @@ namespace stream
|
|||||||
void SetAcceptor (const Acceptor& acceptor) { m_Acceptor = acceptor; };
|
void SetAcceptor (const Acceptor& acceptor) { m_Acceptor = acceptor; };
|
||||||
void ResetAcceptor () { m_Acceptor = nullptr; };
|
void ResetAcceptor () { m_Acceptor = nullptr; };
|
||||||
bool IsAcceptorSet () const { return m_Acceptor != nullptr; };
|
bool IsAcceptorSet () const { return m_Acceptor != nullptr; };
|
||||||
|
void StreamAccepted (std::shared_ptr<Stream> stream);
|
||||||
i2p::client::ClientDestination& GetOwner () { return m_Owner; };
|
i2p::client::ClientDestination& GetOwner () { return m_Owner; };
|
||||||
|
|
||||||
void HandleDataMessagePayload (const uint8_t * buf, size_t len);
|
void HandleDataMessagePayload (const uint8_t * buf, size_t len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user