Browse Source

some cleanup

pull/225/head
orignal 10 years ago
parent
commit
0c8fb376db
  1. 18
      NTCPSession.cpp
  2. 2
      NTCPSession.h
  3. 11
      SSUSession.cpp
  4. 2
      SSUSession.h
  5. 1
      TransportSession.h

18
NTCPSession.cpp

@ -101,7 +101,7 @@ namespace transport @@ -101,7 +101,7 @@ namespace transport
m_DHKeysPair = nullptr;
SendTimeSyncMessage ();
PostI2NPMessage (ToSharedI2NPMessage(CreateDatabaseStoreMsg ())); // we tell immediately who we are
Send (ToSharedI2NPMessage(CreateDatabaseStoreMsg ())); // we tell immediately who we are
transports.PeerConnected (shared_from_this ());
}
@ -673,22 +673,6 @@ namespace transport @@ -673,22 +673,6 @@ namespace transport
Send (nullptr);
}
void NTCPSession::SendI2NPMessage (std::shared_ptr<I2NPMessage> msg)
{
m_Server.GetService ().post (std::bind (&NTCPSession::PostI2NPMessage, shared_from_this (), msg));
}
void NTCPSession::PostI2NPMessage (std::shared_ptr<I2NPMessage> msg)
{
if (msg)
{
if (m_IsTerminated) return;
if (m_IsSending)
m_SendQueue.push_back (msg);
else
Send (msg);
}
}
void NTCPSession::SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs)
{

2
NTCPSession.h

@ -61,12 +61,10 @@ namespace transport @@ -61,12 +61,10 @@ namespace transport
void ClientLogin ();
void ServerLogin ();
void SendI2NPMessage (std::shared_ptr<I2NPMessage> msg);
void SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs);
private:
void PostI2NPMessage (std::shared_ptr<I2NPMessage> msg);
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
void Connected ();
void SendTimeSyncMessage ();

11
SSUSession.cpp

@ -832,17 +832,6 @@ namespace transport @@ -832,17 +832,6 @@ namespace transport
}
}
void SSUSession::SendI2NPMessage (std::shared_ptr<I2NPMessage> msg)
{
GetService ().post (std::bind (&SSUSession::PostI2NPMessage, shared_from_this (), msg));
}
void SSUSession::PostI2NPMessage (std::shared_ptr<I2NPMessage> msg)
{
if (msg &&m_State == eSessionStateEstablished)
m_Data.Send (msg);
}
void SSUSession::SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs)
{
GetService ().post (std::bind (&SSUSession::PostI2NPMessages, shared_from_this (), msgs));

2
SSUSession.h

@ -76,7 +76,6 @@ namespace transport @@ -76,7 +76,6 @@ namespace transport
void Done ();
boost::asio::ip::udp::endpoint& GetRemoteEndpoint () { return m_RemoteEndpoint; };
bool IsV6 () const { return m_RemoteEndpoint.address ().is_v6 (); };
void SendI2NPMessage (std::shared_ptr<I2NPMessage> msg);
void SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs);
void SendPeerTest (); // Alice
@ -95,7 +94,6 @@ namespace transport @@ -95,7 +94,6 @@ namespace transport
boost::asio::io_service& GetService ();
void CreateAESandMacKey (const uint8_t * pubKey);
void PostI2NPMessage (std::shared_ptr<I2NPMessage> msg);
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
void ProcessMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint); // call for established session
void ProcessSessionRequest (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint);

1
TransportSession.h

@ -71,7 +71,6 @@ namespace transport @@ -71,7 +71,6 @@ namespace transport
size_t GetNumSentBytes () const { return m_NumSentBytes; };
size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; };
virtual void SendI2NPMessage (std::shared_ptr<I2NPMessage> msg) = 0;
virtual void SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs) = 0;
protected:

Loading…
Cancel
Save