MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ProcessSessionCreated

Method ProcessSessionCreated

libi2pd/NTCP2.cpp:835–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833 }
834
835 void NTCP2Session::ProcessSessionCreated (size_t len)
836 {
837 LogPrint (eLogDebug, "NTCP2: SessionCreated received ", len);
838 uint16_t paddingLen = 0;
839 if (m_Establisher->ProcessSessionCreatedMessage (paddingLen))
840 {
841 if (paddingLen > 0)
842 {
843#if OPENSSL_PQ
844 if (paddingLen <= m_Establisher->m_MaxMsgSize - 80)
845#else
846 if (paddingLen <= m_Establisher->m_MaxMsgSize - 64)
847#endif
848 {
849 boost::asio::async_read (m_Socket, boost::asio::buffer(m_Establisher->m_Buffer + m_Establisher->m_BufferLen, paddingLen), boost::asio::transfer_all (),
850 std::bind(&NTCP2Session::HandleSessionCreatedPaddingReceived, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
851 }
852 else
853 {
854 LogPrint (eLogWarning, "NTCP2: SessionCreated padding length ", (int)paddingLen, " is too long");
855 boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ()));
856 }
857 }
858 else
859 SendSessionConfirmed ();
860 }
861 else
862 {
863 if (GetRemoteIdentity ())
864 i2p::data::netdb.SetUnreachable (GetRemoteIdentity ()->GetIdentHash (), true); // assume wrong s key
865 boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ()));
866 }
867 }
868
869 void NTCP2Session::HandleSessionCreatedPaddingReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred)
870 {

Callers 2

ProcessNextPacketMethod · 0.45

Calls 3

LogPrintFunction · 0.85
SetUnreachableMethod · 0.45

Tested by

no test coverage detected