aboutsummaryrefslogtreecommitdiff
path: root/src/adbd-client.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-09-21 20:35:21 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-09-21 20:35:21 -0500
commitb74f5f6a37edaab28156e551462407096cfbfcbd (patch)
tree26fad492954215637de7d3888357f195bf46803f /src/adbd-client.cpp
parent3b7185fdf0d21897fd874d337d57379f911cc63c (diff)
downloadayatana-indicator-display-b74f5f6a37edaab28156e551462407096cfbfcbd.tar.gz
ayatana-indicator-display-b74f5f6a37edaab28156e551462407096cfbfcbd.tar.bz2
ayatana-indicator-display-b74f5f6a37edaab28156e551462407096cfbfcbd.zip
adbd-client's std::condition_variable::wait() call seems to be the system_error culprit, so wrapping in try-catch to be cautious
Diffstat (limited to 'src/adbd-client.cpp')
-rw-r--r--src/adbd-client.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/adbd-client.cpp b/src/adbd-client.cpp
index 85389f4..83b15ac 100644
--- a/src/adbd-client.cpp
+++ b/src/adbd-client.cpp
@@ -124,11 +124,11 @@ private:
while (!g_cancellable_is_cancelled(m_cancellable))
{
- g_debug("%s creating a client socket to '%s'", G_STRLOC, socket_path.c_str());
+ g_debug("%s thread %p creating a client socket to '%s'", G_STRLOC, g_thread_self(), socket_path.c_str());
auto socket = create_client_socket(socket_path);
bool got_valid_req = false;
- g_debug("%s calling read_request", G_STRLOC);
+ g_debug("%s thread %p calling read_request", g_thread_self(), G_STRLOC);
std::string reqstr;
if (socket != nullptr)
reqstr = read_request(socket);
@@ -138,16 +138,21 @@ private:
if (reqstr.substr(0,2) == "PK") {
PKResponse response = PKResponse::DENY;
const auto public_key = reqstr.substr(2);
- g_debug("%s got pk [%s]", G_STRLOC, public_key.c_str());
+ g_debug("%s thread %p got pk [%s]", G_STRLOC, g_thread_self(), public_key.c_str());
if (!public_key.empty()) {
got_valid_req = true;
std::unique_lock<std::mutex> lk(m_pkresponse_mutex);
m_pkresponse_ready = false;
+ m_pkresponse = AdbdClient::PKResponse::DENY;
pass_public_key_to_main_thread(public_key);
g_debug("%s thread %p waiting", G_STRLOC, g_thread_self());
- m_pkresponse_cv.wait(lk, [this](){
- return m_pkresponse_ready || g_cancellable_is_cancelled(m_cancellable);
- });
+ try {
+ m_pkresponse_cv.wait(lk, [this](){
+ return m_pkresponse_ready || g_cancellable_is_cancelled(m_cancellable);
+ });
+ } catch (std::system_error& e) {
+ g_critical("%s thread %p unable to wait for response because of unexpected error '%s'", G_STRLOC, g_thread_self(), e.what());
+ }
response = m_pkresponse;
g_debug("%s thread %p got response '%d', is-cancelled %d", G_STRLOC,
g_thread_self(),