mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
Asyc receive from stream
This commit is contained in:
parent
5eb67a08c9
commit
86e233d77a
2 changed files with 48 additions and 22 deletions
10
HTTPServer.h
10
HTTPServer.h
|
@ -5,6 +5,7 @@
|
|||
#include <thread>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "Streaming.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
|
@ -37,7 +38,7 @@ namespace util
|
|||
|
||||
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:
|
||||
|
@ -45,8 +46,10 @@ namespace util
|
|||
void Terminate ();
|
||||
void Receive ();
|
||||
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 HandleWrite(const boost::system::error_code& ecode, bool terminate);
|
||||
void HandleWriteReply(const boost::system::error_code& ecode);
|
||||
void HandleWrite (const boost::system::error_code& ecode);
|
||||
void SendReply (const std::string& content);
|
||||
|
||||
void HandleRequest ();
|
||||
|
@ -57,7 +60,8 @@ namespace util
|
|||
private:
|
||||
|
||||
boost::asio::ip::tcp::socket * m_Socket;
|
||||
char m_Buffer[8192];
|
||||
i2p::stream::Stream * m_Stream;
|
||||
char m_Buffer[8192], m_StreamBuffer[8192];
|
||||
request m_Request;
|
||||
reply m_Reply;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue