feat(network): add stop method to NetworkServer

- Implemented `stop` method in `NetworkServer` to close the acceptor and stop the IO context.
- Updated `NetworkServer.h` with corresponding method declaration and documentation.
This commit is contained in:
Kieran Kihn
2025-11-29 18:47:33 +08:00
parent 042ab95dda
commit b0b6d78630
2 changed files with 11 additions and 0 deletions

View File

@@ -86,4 +86,10 @@ namespace UNO::NETWORK {
{
this->io_context_.run();
}
void NetworkServer::stop()
{
this->acceptor_.close();
this->io_context_.stop();
}
} // namespace UNO::NETWORK

View File

@@ -70,6 +70,11 @@ namespace UNO::NETWORK {
*/
void run();
/**
* 停止网络进程
*/
void stop();
private:
void accept();
};