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
|
|
@ -2,8 +2,10 @@
|
|||
#include "Logger.h"
|
||||
#include "Session.h"
|
||||
|
||||
NetworkService::NetworkService(uint16_t port, int threadCount)
|
||||
: acceptor_(io_context_, tcp::endpoint(tcp::v4(), port)),
|
||||
NetworkService::NetworkService(boost::asio::io_context &io_context,
|
||||
uint16_t port, int threadCount)
|
||||
: io_context_(io_context),
|
||||
acceptor_(io_context_, tcp::endpoint(tcp::v4(), port)),
|
||||
work_guard_(boost::asio::make_work_guard(io_context_)) {
|
||||
threads_.reserve(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue