mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Asyc receive from stream
This commit is contained in:
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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user