From ca9bb338d9a6d4cd1a74326e8f15aa8215a14c5b Mon Sep 17 00:00:00 2001 From: "jin-gyu.kim" Date: Fri, 10 Mar 2017 19:28:59 +0900 Subject: [PATCH] Check POLLIN revent before POLLHUP. - Askuser does not work well with the emulator. - This is due to that POLLHUP can be came in case of EOF. Change-Id: If668886b050e07a8606e45fdd6d54cbb70ed2208 --- src/agent/ui/NotificationBackend.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/agent/ui/NotificationBackend.cpp b/src/agent/ui/NotificationBackend.cpp index 68092c5..2519ff7 100644 --- a/src/agent/ui/NotificationBackend.cpp +++ b/src/agent/ui/NotificationBackend.cpp @@ -173,6 +173,20 @@ bool NotificationBackend::mainLoop() { return false; } + if (m_poller.getEvents(m_clientSocket.getFd()) & POLLIN) { + NotificationResponse response; + if (!recvResponse(response)) { + ALOGE("Couldn't receive response"); + return false; + } + if (!parseResponse(response)) { + ALOGE("Incorrect response received"); + return false; + } + m_responseHandler(m_request.id, NResponseTypeToUI(response.response)); + return true; + } + if (m_poller.getEvents(m_clientSocket.getFd()) & POLLHUP) { ALOGE("Service disconnected"); return false; @@ -187,20 +201,6 @@ bool NotificationBackend::mainLoop() { m_poller.setEvents(m_clientSocket.getFd(), POLLIN | POLLERR); continue; } - - if (m_poller.getEvents(m_clientSocket.getFd()) & POLLIN) { - NotificationResponse response; - if (!recvResponse(response)) { - ALOGE("Couldn't receive response"); - return false; - } - if (!parseResponse(response)) { - ALOGE("Incorrect response received"); - return false; - } - m_responseHandler(m_request.id, NResponseTypeToUI(response.response)); - return true; - } } ALOGD("NotificationBackend loop ended"); -- 2.7.4