Skip to content

Commit

Permalink
Merge 93088a9 into 5c9a805
Browse files Browse the repository at this point in the history
  • Loading branch information
Cropi committed Dec 8, 2020
2 parents 5c9a805 + 93088a9 commit 40664ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Library/IPCClientPrivate.cpp
Expand Up @@ -144,16 +144,20 @@ namespace usbguard
USBGUARD_LOG(Trace) << "_qb_conn=" << _qb_conn
<< " _qb_fd=" << _qb_fd;

std::unique_lock<std::mutex> disconnect_lock(_disconnect_mutex);

if (_qb_conn != nullptr && _qb_fd >= 0) {
qb_loop_poll_del(_qb_loop, _qb_fd);
qb_ipcc_disconnect(_qb_conn);
_qb_conn = nullptr;
_qb_fd = -1;
disconnect_lock.unlock();
stop(do_wait);
USBGUARD_LOG(Trace) << "Signaling IPCDisconnected";
_p_instance.IPCDisconnected(/*exception_initiated=*/true, exception);
}
else if (_thread.running()) {
disconnect_lock.unlock();
stop(do_wait);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Library/IPCClientPrivate.hpp
Expand Up @@ -119,7 +119,7 @@ namespace usbguard

int _wakeup_fd;

std::mutex _return_mutex;
std::mutex _return_mutex, _disconnect_mutex;
std::map<uint64_t, std::promise<IPC::MessagePointer>> _return_map;

Thread<IPCClientPrivate> _thread;
Expand Down

0 comments on commit 40664ed

Please sign in to comment.