mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
switch to AsyncReceive in HTTPProxy
This commit is contained in:
parent
086b0d5418
commit
02a42b0e98
2 changed files with 66 additions and 46 deletions
13
HTTPProxy.h
13
HTTPProxy.h
|
@ -39,15 +39,19 @@ namespace proxy
|
|||
|
||||
public:
|
||||
|
||||
HTTPConnection (boost::asio::ip::tcp::socket * socket): m_Socket (socket) { Receive (); };
|
||||
HTTPConnection (boost::asio::ip::tcp::socket * socket): m_Socket (socket), m_Stream (nullptr) { Receive (); };
|
||||
~HTTPConnection () { delete m_Socket; }
|
||||
|
||||
private:
|
||||
|
||||
void Terminate ();
|
||||
void Receive ();
|
||||
void HandleReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||
void HandleWrite(const boost::system::error_code& ecode);
|
||||
void HandleReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||
void AsyncStreamReceive ();
|
||||
void HandleStreamReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||
void HandleWriteReply(const boost::system::error_code& ecode);
|
||||
void HandleWrite (const boost::system::error_code& ecode);
|
||||
void SendReply (const std::string& content);
|
||||
|
||||
void HandleDestinationRequest (const std::string& address, const std::string& uri);
|
||||
std::pair<std::string, std::string> ExtractRequest ();
|
||||
|
@ -55,8 +59,9 @@ namespace proxy
|
|||
|
||||
private:
|
||||
|
||||
i2p::stream::Stream * m_Stream;
|
||||
boost::asio::ip::tcp::socket * m_Socket;
|
||||
char m_Buffer[8192];
|
||||
char m_Buffer[8192], m_StreamBuffer[8192];
|
||||
request m_Request;
|
||||
reply m_Reply;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue