Skip to content

Commit

Permalink
update asio
Browse files Browse the repository at this point in the history
  • Loading branch information
qiin2333 committed Jan 14, 2025
1 parent 31cb0b5 commit f053750
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ namespace nvhttp {

class SunshineHTTPS: public SimpleWeb::HTTPS {
public:
SunshineHTTPS(boost::asio::io_service &io_service, boost::asio::ssl::context &ctx):
SimpleWeb::HTTPS(io_service, ctx) {}
SunshineHTTPS(boost::asio::io_context &io_context, boost::asio::ssl::context &ctx):
SimpleWeb::HTTPS(io_context, ctx) {}

virtual ~SunshineHTTPS() {
// Gracefully shutdown the TLS connection
Expand Down
16 changes: 8 additions & 8 deletions src/rtsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ namespace rtsp_stream {

class socket_t: public std::enable_shared_from_this<socket_t> {
public:
socket_t(boost::asio::io_service &ios, std::function<void(tcp::socket &sock, launch_session_t &, msg_t &&)> &&handle_data_fn):
handle_data_fn { std::move(handle_data_fn) }, sock { ios } {}
socket_t(boost::asio::io_context &io_context, std::function<void(tcp::socket &sock, launch_session_t &, msg_t &&)> &&handle_data_fn):
handle_data_fn { std::move(handle_data_fn) }, sock { io_context } {}

/**
* @brief Queue an asynchronous read to begin the next message.
Expand Down Expand Up @@ -435,7 +435,7 @@ namespace rtsp_stream {
return -1;
}

next_socket = std::make_shared<socket_t>(ios, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) {
next_socket = std::make_shared<socket_t>(io_context, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) {
handle_msg(sock, session, std::move(msg));
});

Expand All @@ -449,7 +449,7 @@ namespace rtsp_stream {
template <class T, class X>
void
iterate(std::chrono::duration<T, X> timeout) {
ios.run_one_for(timeout);
io_context.run_one_for(timeout);
}

void
Expand Down Expand Up @@ -494,7 +494,7 @@ namespace rtsp_stream {
}

// Queue another asynchronous accept for the next incoming connection
next_socket = std::make_shared<socket_t>(ios, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) {
next_socket = std::make_shared<socket_t>(io_context, [this](tcp::socket &sock, launch_session_t &session, msg_t &&msg) {
handle_msg(sock, session, std::move(msg));
});
acceptor.async_accept(next_socket->sock, [this](const auto &ec) {
Expand Down Expand Up @@ -618,8 +618,8 @@ namespace rtsp_stream {

std::chrono::steady_clock::time_point raised_timeout;

boost::asio::io_service ios;
tcp::acceptor acceptor { ios };
boost::asio::io_context io_context;
tcp::acceptor acceptor { io_context };

std::shared_ptr<socket_t> next_socket;
};
Expand Down Expand Up @@ -1213,4 +1213,4 @@ namespace rtsp_stream {
<< messageBuffer << std::endl
<< "---End MessageBuffer---"sv << std::endl;
}
} // namespace rtsp_stream
} // namespace rtsp_stream
10 changes: 5 additions & 5 deletions src/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ namespace stream {
std::thread audio_thread;
std::thread control_thread;

asio::io_service io;
asio::io_context io_context;

udp::socket video_sock { io };
udp::socket audio_sock { io };
udp::socket video_sock { io_context };
udp::socket audio_sock { io_context };

control_server_t control_server;
};
Expand Down Expand Up @@ -1184,7 +1184,7 @@ namespace stream {
auto &message_queue_queue = ctx.message_queue_queue;
auto broadcast_shutdown_event = mail::man->event<bool>(mail::broadcast_shutdown);

auto &io = ctx.io;
auto &io = ctx.io_context;

udp::endpoint peer;

Expand Down Expand Up @@ -1778,7 +1778,7 @@ namespace stream {
audio_packets->stop();

ctx.message_queue_queue->stop();
ctx.io.stop();
ctx.io_context.stop();

ctx.video_sock.close();
ctx.audio_sock.close();
Expand Down
2 changes: 1 addition & 1 deletion src_assets/common/assets/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2>Version {{version.version}}</h2>
<div class="alert alert-warning">
<div class="d-flex justify-content-between">
<div class="my-2">{{ $t('index.new_stable') }}</div>
<a class="btn btn-success m-1" :href="`https://github.moeyy.xyz/${githubVersion.release.html_url}`" target="_blank">{{ $t('index.download') }}</a>
<a class="btn btn-success m-1" :href="githubVersion.release.html_url" target="_blank">{{ $t('index.download') }}</a>
</div>
<h3>{{githubVersion.release.name}}</h3>
<pre v-html="githubVersion.release.body"></pre>
Expand Down

0 comments on commit f053750

Please sign in to comment.