mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-20 03:30:45 -04:00
fix: Replace deprecated io_service with io_context in UDP client
Updates UDP client code to use boost::asio::io_context instead of the deprecated boost::asio::io_service, fixing compilation errors with newer Boost versions. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: 2018 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2018 Citra Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
@@ -26,8 +27,8 @@ public:
|
|||||||
using clock = std::chrono::system_clock;
|
using clock = std::chrono::system_clock;
|
||||||
|
|
||||||
explicit Socket(const std::string& host, u16 port, SocketCallback callback_)
|
explicit Socket(const std::string& host, u16 port, SocketCallback callback_)
|
||||||
: callback(std::move(callback_)), timer(io_service),
|
: callback(std::move(callback_)), timer(io_context),
|
||||||
socket(io_service, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
|
socket(io_context, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
|
||||||
boost::system::error_code ec{};
|
boost::system::error_code ec{};
|
||||||
auto ipv4 = boost::asio::ip::make_address_v4(host, ec);
|
auto ipv4 = boost::asio::ip::make_address_v4(host, ec);
|
||||||
if (ec.value() != boost::system::errc::success) {
|
if (ec.value() != boost::system::errc::success) {
|
||||||
@@ -39,11 +40,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Stop() {
|
void Stop() {
|
||||||
io_service.stop();
|
io_context.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loop() {
|
void Loop() {
|
||||||
io_service.run();
|
io_context.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartSend(const clock::time_point& from) {
|
void StartSend(const clock::time_point& from) {
|
||||||
@@ -113,7 +114,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SocketCallback callback;
|
SocketCallback callback;
|
||||||
boost::asio::io_service io_service;
|
boost::asio::io_context io_context;
|
||||||
boost::asio::basic_waitable_timer<clock> timer;
|
boost::asio::basic_waitable_timer<clock> timer;
|
||||||
udp::socket socket;
|
udp::socket socket;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user