Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何停止服务端 #145

Open
ZHBHFUT opened this issue Aug 13, 2024 · 4 comments
Open

如何停止服务端 #145

ZHBHFUT opened this issue Aug 13, 2024 · 4 comments

Comments

@ZHBHFUT
Copy link

ZHBHFUT commented Aug 13, 2024

需求:固定数量的客户端,每个客户端在退出时都远程调用stop函数,服务端接收到所有调用自动退出,而非阻塞在server.run()中。

目前是在调用线程中call exit()直接结束程序,但这样就没法做相应的后续清理工作。

@qicosmos
Copy link
Owner

两种方法,一种将server的智能指针设置为null
另一种方法调用do_await_stop,收到信号退出

@ZHBHFUT
Copy link
Author

ZHBHFUT commented Aug 15, 2024

抱歉我不太熟悉,请问什么是server的智能指针?do_await_stop是哪个对象的方法?

@qicosmos
Copy link
Owner

通过智能指针创建server。
do_await_stop 就是server里面的方法。

@ZHBHFUT
Copy link
Author

ZHBHFUT commented Aug 16, 2024

好的,我试一下,非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants