Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/stream_outlet_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ stream_outlet_impl::stream_outlet_impl(const stream_info_impl &info, int32_t chu
for (const auto &io : {io_ctx_data_, io_ctx_service_})
io_threads_.emplace_back(std::make_shared<std::thread>([io, name]() {
loguru::set_thread_name(name.c_str());
while (true) {
while (!io->stopped()) {
try {
io->run();
return;
Expand Down
7 changes: 5 additions & 2 deletions src/tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ void tcp_server::end_serving() {

void tcp_server::accept_next_connection(tcp_acceptor_p &acceptor) {
try {
if (!acceptor || !acceptor->is_open()) return;

// Select the IO context for handling the socket
auto &sock_io_ctx = *io_;

Expand All @@ -223,8 +225,9 @@ void tcp_server::accept_next_connection(tcp_acceptor_p &acceptor) {
else
LOG_F(WARNING, "Unhandled accept error: %s", err.message().c_str());

// and move on to the next connection
shared_this->accept_next_connection(acceptor);
// move on to the next connection if the acceptor is still open
if (acceptor && acceptor->is_open())
shared_this->accept_next_connection(acceptor);
});
} catch (std::exception &e) {
LOG_F(ERROR, "Error during tcp_server::accept_next_connection: %s", e.what());
Expand Down
5 changes: 3 additions & 2 deletions src/udp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ void udp_server::process_timedata_request(std::istream &request_stream, double t
void udp_server::handle_receive_outcome(err_t err, std::size_t len) {
DLOG_F(6, "udp_server::handle_receive_outcome (%lub)", len);
if (err) {
// non-critical error? Wait for the next packet
if (err != asio::error::operation_aborted || err != asio::error::shut_down)
// non-critical error? Wait for the next packet if the socket is still open
if (err != asio::error::operation_aborted && err != asio::error::shut_down
&& socket_ && socket_->is_open())
request_next_packet();
return;
}
Expand Down
Loading