mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
command channel acceptor
This commit is contained in:
parent
e7f05cc462
commit
3ab65bbe0d
2 changed files with 101 additions and 1 deletions
35
BOB.h
35
BOB.h
|
@ -1,10 +1,28 @@
|
|||
#ifndef BOB_H__
|
||||
#define BOB_H__
|
||||
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <boost/asio.hpp>
|
||||
#include "Streaming.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace client
|
||||
{
|
||||
class BOBDataStream: public std::enable_shared_from_this<BOBDataStream>
|
||||
{
|
||||
public:
|
||||
|
||||
BOBDataStream (std::shared_ptr<boost::asio::ip::tcp::socket> socket,
|
||||
std::shared_ptr<i2p::stream::Stream> stream);
|
||||
|
||||
private:
|
||||
|
||||
std::shared_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||
std::shared_ptr<i2p::stream::Stream> m_Stream;
|
||||
};
|
||||
|
||||
class BOBCommandChannel
|
||||
{
|
||||
|
@ -12,6 +30,23 @@ namespace client
|
|||
|
||||
BOBCommandChannel (int port);
|
||||
~BOBCommandChannel ();
|
||||
|
||||
void Start ();
|
||||
void Stop ();
|
||||
|
||||
private:
|
||||
|
||||
void Run ();
|
||||
void Accept ();
|
||||
void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<boost::asio::ip::tcp::socket> socket);
|
||||
|
||||
private:
|
||||
|
||||
bool m_IsRunning;
|
||||
std::thread * m_Thread;
|
||||
boost::asio::io_service m_Service;
|
||||
boost::asio::ip::tcp::acceptor m_Acceptor;
|
||||
std::list<std::shared_ptr<BOBDataStream> > m_DataStreams;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue