[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phoneblocker] frontends/blackberry/headless: Handle the case when the client disconnects from the c
From:       Laszlo Papp <lpapp () kde ! org>
Date:       2015-01-19 7:29:55
Message-ID: E1YD6mZ-0003L2-Gg () scm ! kde ! org
[Download RAW message or body]

Git commit 1bfc2dbd94dba7f5de4e88a652db0ccdfdda7ff1 by Laszlo Papp.
Committed on 19/01/2015 at 07:25.
Pushed by lpapp into branch 'master'.

Handle the case when the client disconnects from the communicating socket

M  +8    -0    frontends/blackberry/headless/blocker.cpp
M  +1    -0    frontends/blackberry/headless/blocker.h

http://commits.kde.org/phoneblocker/1bfc2dbd94dba7f5de4e88a652db0ccdfdda7ff1

diff --git a/frontends/blackberry/headless/blocker.cpp b/frontends/blackberry/headless/blocker.cpp
index abc397f..00b78ba 100644
--- a/frontends/blackberry/headless/blocker.cpp
+++ b/frontends/blackberry/headless/blocker.cpp
@@ -184,6 +184,7 @@ void Blocker::listen()
 void Blocker::handleNewConnection()
 {
     m_socket = m_server.nextPendingConnection();
+    connect(m_socket, SIGNAL(disconnected()), SLOT(disconnected()));
     connect(m_socket, SIGNAL(readyRead()), SLOT(read()));
 }
 
@@ -241,3 +242,10 @@ void Blocker::read()
         else if (ccall == 'u') unblockCall(phoneNumber);
     }
 }
+
+void Blocker::handleDisconnected()
+{
+    disconnect(m_socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
+    disconnect(m_socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
+    m_socket->close();
+}
diff --git a/frontends/blackberry/headless/blocker.h b/frontends/blackberry/headless/blocker.h
index a201710..70fd91c 100644
--- a/frontends/blackberry/headless/blocker.h
+++ b/frontends/blackberry/headless/blocker.h
@@ -65,6 +65,7 @@ private Q_SLOTS:
     void listen();
     void handleNewConnection();
     void read();
+    void handleDisconnected();
 
 private:
     bb::system::phone::Phone m_phone;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic