aboutsummaryrefslogtreecommitdiff
path: root/src/HciAdapter.cpp
diff options
context:
space:
mode:
authorPaul Nettle <nettle.paul@gmail.com>2018-01-08 07:42:09 -0600
committerPaul Nettle <nettle.paul@gmail.com>2018-01-08 07:42:09 -0600
commita7a0a74aa8d2a817ea9250dd3b93edf19ad0549e (patch)
treecab73cb12fe42abe84613ef8dec6248afed5109e /src/HciAdapter.cpp
parentCleaned up the deinitialization process to avoid inadvertent calls to shutdown (diff)
downloadgobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.tar.gz
gobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.tar.bz2
gobbledegook-a7a0a74aa8d2a817ea9250dd3b93edf19ad0549e.zip
Improved handling of connection counts dealing with latent disconnects on startup. This includes a change to change to the behavior of change notifications for values, they no longer check for an active connection before transmitting - this is now up to the caller.HEADmaster
Diffstat (limited to 'src/HciAdapter.cpp')
-rw-r--r--src/HciAdapter.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/HciAdapter.cpp b/src/HciAdapter.cpp
index ad27ce0..eb1990f 100644
--- a/src/HciAdapter.cpp
+++ b/src/HciAdapter.cpp
@@ -346,13 +346,22 @@ void HciAdapter::runEventThread()
{
DeviceConnectedEvent event(responsePacket);
activeConnections += 1;
+ Logger::debug(SSTR << " > Connection count incremented to " << activeConnections);
break;
}
// Command status event
case Mgmt::EDeviceDisconnectedEvent:
{
DeviceDisconnectedEvent event(responsePacket);
- activeConnections -= 1;
+ if (activeConnections > 0)
+ {
+ activeConnections -= 1;
+ Logger::debug(SSTR << " > Connection count decremented to " << activeConnections);
+ }
+ else
+ {
+ Logger::debug(SSTR << " > Connection count already at zero, ignoring non-connected disconnect event");
+ }
break;
}
// Unsupported