init
This commit is contained in:
commit
b887f15662
21 changed files with 1038 additions and 0 deletions
25
include/NetworkService.h
Normal file
25
include/NetworkService.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
|
||||
class NetworkService {
|
||||
public:
|
||||
NetworkService(uint16_t port, int threadCount);
|
||||
~NetworkService();
|
||||
|
||||
void Run();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
void DoAccept();
|
||||
|
||||
boost::asio::io_context io_context_;
|
||||
std::vector<std::jthread> threads_;
|
||||
tcp::acceptor acceptor_;
|
||||
boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
|
||||
work_guard_;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue