mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
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:
@@ -86,4 +86,10 @@ namespace UNO::NETWORK {
|
|||||||
{
|
{
|
||||||
this->io_context_.run();
|
this->io_context_.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkServer::stop()
|
||||||
|
{
|
||||||
|
this->acceptor_.close();
|
||||||
|
this->io_context_.stop();
|
||||||
|
}
|
||||||
} // namespace UNO::NETWORK
|
} // namespace UNO::NETWORK
|
||||||
@@ -70,6 +70,11 @@ namespace UNO::NETWORK {
|
|||||||
*/
|
*/
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止网络进程
|
||||||
|
*/
|
||||||
|
void stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void accept();
|
void accept();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user