mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Explicitly close all sockets on shutdown
This way we're sure to break out of any blocking loops.
This commit is contained in:
@@ -260,8 +260,10 @@ class EventHandler {
|
||||
* `boost::system_error` when this happens.
|
||||
*/
|
||||
void close() {
|
||||
// The shutdown can fail when the socket is already closed
|
||||
boost::system::error_code err;
|
||||
socket.shutdown(
|
||||
boost::asio::local::stream_protocol::socket::shutdown_both);
|
||||
boost::asio::local::stream_protocol::socket::shutdown_both, err);
|
||||
socket.close();
|
||||
}
|
||||
|
||||
@@ -653,6 +655,24 @@ class Sockets {
|
||||
// then we can just silently ignore this
|
||||
}
|
||||
}
|
||||
|
||||
// Manually close all sockets so we break out of any blocking operations
|
||||
// that may still be active
|
||||
host_vst_dispatch.close();
|
||||
host_vst_dispatch_midi_events.close();
|
||||
vst_host_callback.close();
|
||||
|
||||
// These shutdowns can fail when the socket has already been closed, but
|
||||
// that's not an issue in our case
|
||||
constexpr auto shutdown_type =
|
||||
boost::asio::local::stream_protocol::socket::shutdown_both;
|
||||
boost::system::error_code err;
|
||||
host_vst_parameters.shutdown(shutdown_type, err);
|
||||
host_vst_process_replacing.shutdown(shutdown_type, err);
|
||||
host_vst_control.shutdown(shutdown_type, err);
|
||||
host_vst_parameters.close();
|
||||
host_vst_process_replacing.close();
|
||||
host_vst_control.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user