mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-16 02:56:52 +02:00
send queue for incoming I2CP messages
This commit is contained in:
parent
c875ff923a
commit
771480e368
2 changed files with 82 additions and 14 deletions
|
@ -25,6 +25,7 @@ namespace client
|
|||
const uint8_t I2CP_PROTOCOL_BYTE = 0x2A;
|
||||
const size_t I2CP_SESSION_BUFFER_SIZE = 4096;
|
||||
const size_t I2CP_MAX_MESSAGE_LENGTH = 65535;
|
||||
const size_t I2CP_MAX_SEND_QUEUE_SIZE = 256;
|
||||
|
||||
const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
|
||||
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;
|
||||
|
@ -122,6 +123,8 @@ namespace client
|
|||
class I2CPServer;
|
||||
class I2CPSession: public std::enable_shared_from_this<I2CPSession>
|
||||
{
|
||||
typedef std::shared_ptr<std::vector<boost::asio::const_buffer> > SendQueue;
|
||||
|
||||
public:
|
||||
|
||||
#ifdef ANDROID
|
||||
|
@ -167,7 +170,8 @@ namespace client
|
|||
void HandleMessage ();
|
||||
void Terminate ();
|
||||
|
||||
void HandleI2CPMessageSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, const uint8_t * buf);
|
||||
void HandleI2CPMessageSent (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||
void HandleI2CPMessageSentQueue (const boost::system::error_code& ecode, std::size_t bytes_transferred, SendQueue queue);
|
||||
std::string ExtractString (const uint8_t * buf, size_t len);
|
||||
size_t PutString (uint8_t * buf, size_t len, const std::string& str);
|
||||
void ExtractMapping (const uint8_t * buf, size_t len, std::map<std::string, std::string>& mapping);
|
||||
|
@ -186,6 +190,11 @@ namespace client
|
|||
uint16_t m_SessionID;
|
||||
uint32_t m_MessageID;
|
||||
bool m_IsSendAccepted;
|
||||
|
||||
// to client
|
||||
bool m_IsSending;
|
||||
uint8_t m_SendBuffer[I2CP_MAX_MESSAGE_LENGTH];
|
||||
SendQueue m_SendQueue;
|
||||
};
|
||||
typedef void (I2CPSession::*I2CPMessageHandler)(const uint8_t * buf, size_t len);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue