mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-18 08:28:58 +02:00
[network, qt] use jthread and use std::vector for packet list instead of std::list (#254)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/254 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
28a78d76fe
commit
19494bc7ac
11 changed files with 305 additions and 403 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
|
|
@ -22,13 +22,9 @@ public:
|
|||
: socket(io_context, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
|
||||
|
||||
~FakeCemuhookServer() {
|
||||
is_running = false;
|
||||
boost::system::error_code error_code;
|
||||
socket.shutdown(boost::asio::socket_base::shutdown_both, error_code);
|
||||
socket.close();
|
||||
if (handler.joinable()) {
|
||||
handler.join();
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetPort() {
|
||||
|
|
@ -45,10 +41,9 @@ public:
|
|||
sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>);
|
||||
|
||||
REQUIRE(touch_movement_path.size() > 0);
|
||||
is_running = true;
|
||||
handler = std::thread([touch_movement_path, this]() {
|
||||
handler = std::jthread([touch_movement_path, this](std::stop_token stoken) {
|
||||
auto current_touch_position = touch_movement_path.begin();
|
||||
while (is_running) {
|
||||
while (!stoken.stop_requested()) {
|
||||
boost::asio::ip::udp::endpoint sender_endpoint;
|
||||
boost::system::error_code error_code;
|
||||
auto received_size = socket.receive_from(boost::asio::buffer(receive_buffer),
|
||||
|
|
@ -91,8 +86,7 @@ private:
|
|||
boost::asio::ip::udp::socket socket;
|
||||
std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> send_buffer;
|
||||
std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> receive_buffer;
|
||||
bool is_running = false;
|
||||
std::thread handler;
|
||||
std::jthread handler;
|
||||
};
|
||||
|
||||
TEST_CASE("CalibrationConfigurationJob completed", "[input_common]") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue