mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Lock the active plugins map early
To prevent a race condition when an exiting plugin wants to terminate the process when it think there are no plugins left just as another yabridge instance is connecting to the group socket.
This commit is contained in:
@@ -98,6 +98,8 @@ void GroupBridge::accept_requests() {
|
||||
group_socket_acceptor.async_accept(
|
||||
[&](const boost::system::error_code& error,
|
||||
boost::asio::local::stream_protocol::socket socket) {
|
||||
std::lock_guard lock(active_plugins_mutex);
|
||||
|
||||
// Stop the whole process when the socket gets closed unexpectedly
|
||||
if (error.failed()) {
|
||||
logger.log("Error while listening for incoming connections:");
|
||||
@@ -120,7 +122,6 @@ void GroupBridge::accept_requests() {
|
||||
|
||||
// Collisions in the generated socket names should be very rare, but
|
||||
// it could in theory happen
|
||||
std::lock_guard lock(active_plugins_mutex);
|
||||
assert(active_plugins.find(parameters) != active_plugins.end());
|
||||
|
||||
// CreateThread() doesn't support multiple arguments and requires
|
||||
|
||||
Reference in New Issue
Block a user