refactor: integrate shared io_context across all services
This commit is contained in:
parent
2d35fd6c8b
commit
c306c4233a
4 changed files with 11 additions and 5 deletions
|
|
@ -8,7 +8,8 @@ using boost::asio::ip::tcp;
|
|||
|
||||
class NetworkService {
|
||||
public:
|
||||
NetworkService(uint16_t port, int threadCount);
|
||||
NetworkService(boost::asio::io_context &io_context, uint16_t port,
|
||||
int threadCount);
|
||||
~NetworkService();
|
||||
|
||||
void Run();
|
||||
|
|
@ -17,7 +18,7 @@ public:
|
|||
private:
|
||||
void DoAccept();
|
||||
|
||||
boost::asio::io_context io_context_;
|
||||
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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue