lichao
2021-05-27 026bbfaf2b5d73a26b8e2fa49158883ef64c211b
box/tcp_server.h
@@ -18,23 +18,23 @@
#ifndef TCP_SERVER_795VXR94
#define TCP_SERVER_795VXR94
#include "bh_util.h"
#include "io_service.h"
#include "tcp_common.h"
#include <thread>
class TcpServer
class NodeCenter;
class TcpServer : public IoService
{
public:
   explicit TcpServer(int port);
   typedef std::shared_ptr<Synced<NodeCenter>> CenterPtr;
   TcpServer(int port, CenterPtr pscenter);
   ~TcpServer();
   bool Start();
   void Stop();
private:
   virtual void OnStop();
   void Accept();
   std::thread worker_;
   std::atomic<bool> run_;
   boost::asio::io_context io_;
   tcp::acceptor listener_;
   CenterPtr pscenter_;
};
#endif // end of include guard: TCP_SERVER_795VXR94