mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
some cleanup
This commit is contained in:
parent
86f86fc711
commit
4ad6cef5a5
|
@ -337,8 +337,8 @@ namespace client
|
||||||
}
|
}
|
||||||
|
|
||||||
I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr<boost::asio::ip::tcp::socket> socket):
|
I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr<boost::asio::ip::tcp::socket> socket):
|
||||||
m_Owner (owner), m_Socket (socket), m_ReadinessCheckTimer (owner.GetService ()),
|
m_Owner (owner), m_Socket (socket), m_SessionID (0xFFFF), m_MessageID (0),
|
||||||
m_SessionID (0xFFFF), m_MessageID (0), m_IsSendAccepted (true), m_IsSending (false)
|
m_IsSendAccepted (true), m_IsSending (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,6 @@ namespace client
|
||||||
|
|
||||||
void I2CPSession::Terminate ()
|
void I2CPSession::Terminate ()
|
||||||
{
|
{
|
||||||
m_ReadinessCheckTimer.cancel ();
|
|
||||||
if (m_Destination)
|
if (m_Destination)
|
||||||
{
|
{
|
||||||
m_Destination->Stop ();
|
m_Destination->Stop ();
|
||||||
|
@ -652,8 +651,6 @@ namespace client
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "I2CP: Session ", m_SessionID, " created");
|
LogPrint (eLogDebug, "I2CP: Session ", m_SessionID, " created");
|
||||||
m_Destination->Start ();
|
m_Destination->Start ();
|
||||||
/*// check if ready, or schedule readiness timer
|
|
||||||
HandleSessionReadinessCheckTimer (boost::system::error_code ());*/
|
|
||||||
SendSessionStatusMessage (eI2CPSessionStatusCreated); // created
|
SendSessionStatusMessage (eI2CPSessionStatusCreated); // created
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -675,27 +672,6 @@ namespace client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2CPSession::HandleSessionReadinessCheckTimer (const boost::system::error_code& ecode)
|
|
||||||
{
|
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
|
||||||
{
|
|
||||||
if (m_Destination)
|
|
||||||
{
|
|
||||||
if (m_Destination->IsReady ())
|
|
||||||
{
|
|
||||||
LogPrint (eLogDebug, "I2CP: Session ", m_SessionID, " created");
|
|
||||||
SendSessionStatusMessage (eI2CPSessionStatusCreated); // created
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_ReadinessCheckTimer.expires_from_now (boost::posix_time::seconds(I2CP_SESSION_READINESS_CHECK_INTERVAL));
|
|
||||||
m_ReadinessCheckTimer.async_wait (std::bind (&I2CPSession::HandleSessionReadinessCheckTimer,
|
|
||||||
shared_from_this (), std::placeholders::_1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2CPSession::DestroySessionMessageHandler (const uint8_t * buf, size_t len)
|
void I2CPSession::DestroySessionMessageHandler (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
SendSessionStatusMessage (eI2CPSessionStatusDestroyed); // destroy
|
SendSessionStatusMessage (eI2CPSessionStatusDestroyed); // destroy
|
||||||
|
|
|
@ -30,7 +30,6 @@ namespace client
|
||||||
const size_t I2CP_MAX_MESSAGE_LENGTH = 65535;
|
const size_t I2CP_MAX_MESSAGE_LENGTH = 65535;
|
||||||
const size_t I2CP_MAX_SEND_QUEUE_SIZE = 1024*1024; // in bytes, 1M
|
const size_t I2CP_MAX_SEND_QUEUE_SIZE = 1024*1024; // in bytes, 1M
|
||||||
const int I2CP_LEASESET_CREATION_TIMEOUT = 10; // in seconds
|
const int I2CP_LEASESET_CREATION_TIMEOUT = 10; // in seconds
|
||||||
const int I2CP_SESSION_READINESS_CHECK_INTERVAL = 3; // in seconds
|
|
||||||
|
|
||||||
const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
|
const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
|
||||||
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;
|
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;
|
||||||
|
@ -198,13 +197,10 @@ namespace client
|
||||||
void SendSessionStatusMessage (I2CPSessionStatus status);
|
void SendSessionStatusMessage (I2CPSessionStatus status);
|
||||||
void SendHostReplyMessage (uint32_t requestID, std::shared_ptr<const i2p::data::IdentityEx> identity);
|
void SendHostReplyMessage (uint32_t requestID, std::shared_ptr<const i2p::data::IdentityEx> identity);
|
||||||
|
|
||||||
void HandleSessionReadinessCheckTimer (const boost::system::error_code& ecode);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
I2CPServer& m_Owner;
|
I2CPServer& m_Owner;
|
||||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||||
boost::asio::deadline_timer m_ReadinessCheckTimer;
|
|
||||||
uint8_t m_Header[I2CP_HEADER_SIZE], m_Payload[I2CP_MAX_MESSAGE_LENGTH];
|
uint8_t m_Header[I2CP_HEADER_SIZE], m_Payload[I2CP_MAX_MESSAGE_LENGTH];
|
||||||
size_t m_PayloadLen;
|
size_t m_PayloadLen;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue