mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 07:30:06 +00:00
rpc: send ending packet in Server instead of UDPServer
udp_server might not be created due to error (occupied port etc.), in which case its destructor and thread-ending call chain will not be excuted in Server::Stop. However, the ending packet still need to be send no matter udp is on or not, so move it to Server::Stop
This commit is contained in:
parent
5f80075c31
commit
870579d38f
@ -25,6 +25,7 @@ void Server::Start() {
|
|||||||
|
|
||||||
void Server::Stop() {
|
void Server::Stop() {
|
||||||
udp_server.reset();
|
udp_server.reset();
|
||||||
|
NewRequestCallback(nullptr); // Notify the RPC server to end
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::NewRequestCallback(std::unique_ptr<RPC::Packet> new_request) {
|
void Server::NewRequestCallback(std::unique_ptr<RPC::Packet> new_request) {
|
||||||
|
@ -20,10 +20,7 @@ public:
|
|||||||
new_request_callback(std::move(new_request_callback)) {
|
new_request_callback(std::move(new_request_callback)) {
|
||||||
|
|
||||||
StartReceive();
|
StartReceive();
|
||||||
worker_thread = std::thread([this] {
|
worker_thread = std::thread([this] { io_context.run(); });
|
||||||
io_context.run();
|
|
||||||
this->new_request_callback(nullptr);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~Impl() {
|
~Impl() {
|
||||||
|
Loading…
Reference in New Issue
Block a user