|
@@ -281,11 +281,13 @@ NetIO::NetIO(boost::asio::io_context &io_context, const Config &config)
|
|
|
|
|
|
|
|
|
if(me==0) {
|
|
|
- tcp::acceptor async_acceptor(io_context,
|
|
|
- resolver.resolve(myconf.clistenhost, myconf.clistenport)->endpoint());
|
|
|
+ client_acceptor = std::shared_ptr<tcp::acceptor>(
|
|
|
+ new tcp::acceptor(io_context,
|
|
|
+ resolver.resolve(myconf.clistenhost,
|
|
|
+ myconf.clistenport)->endpoint()));
|
|
|
std::shared_ptr<tcp::socket> new_socket(new tcp::socket(io_context));
|
|
|
- std::cout << myconf.clistenhost << ":" << myconf.clistenport;
|
|
|
- async_acceptor.async_accept(*new_socket, accept_handler);
|
|
|
+ std::cout << "Accepting on " << myconf.clistenhost << ":" << myconf.clistenport << "\n";
|
|
|
+ client_acceptor->async_accept(*new_socket, accept_handler);
|
|
|
}
|
|
|
|
|
|
|