mirror of
https://git.citron-emu.org/citron/emu
synced 2025-05-12 19:00:37 +01:00
fix: update deprecated boost::asio::io_service to io_context
Updates UDP client and related test files to use boost::asio::io_context instead of the deprecated io_service. This change is required for compatibility with newer versions of Boost ASIO, which has renamed the class. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
parent
58401f5b39
commit
21ca0b3119
2 changed files with 9 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: 2018 Citra Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <random>
|
||||
|
@ -26,8 +27,8 @@ public:
|
|||
using clock = std::chrono::system_clock;
|
||||
|
||||
explicit Socket(const std::string& host, u16 port, SocketCallback callback_)
|
||||
: callback(std::move(callback_)), timer(io_service),
|
||||
socket(io_service, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
|
||||
: callback(std::move(callback_)), timer(io_context),
|
||||
socket(io_context, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
|
||||
boost::system::error_code ec{};
|
||||
auto ipv4 = boost::asio::ip::make_address_v4(host, ec);
|
||||
if (ec.value() != boost::system::errc::success) {
|
||||
|
@ -39,11 +40,11 @@ public:
|
|||
}
|
||||
|
||||
void Stop() {
|
||||
io_service.stop();
|
||||
io_context.stop();
|
||||
}
|
||||
|
||||
void Loop() {
|
||||
io_service.run();
|
||||
io_context.run();
|
||||
}
|
||||
|
||||
void StartSend(const clock::time_point& from) {
|
||||
|
@ -113,7 +114,7 @@ private:
|
|||
}
|
||||
|
||||
SocketCallback callback;
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_context io_context;
|
||||
boost::asio::basic_waitable_timer<clock> timer;
|
||||
udp::socket socket;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <array>
|
||||
|
@ -14,7 +15,7 @@
|
|||
class FakeCemuhookServer {
|
||||
public:
|
||||
FakeCemuhookServer()
|
||||
: socket(io_service, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
|
||||
: socket(io_context, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
|
||||
|
||||
~FakeCemuhookServer() {
|
||||
is_running = false;
|
||||
|
@ -82,7 +83,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_context io_context;
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue