diff --git a/lib/hci-socket/hci.js b/lib/hci-socket/hci.js index 2eb1658..b454d9e 100644 --- a/lib/hci-socket/hci.js +++ b/lib/hci-socket/hci.js @@ -133,7 +133,6 @@ class Hci extends EventEmitter { } resetBuffers () { - this._mainHandle = null; this._handleAclsInProgress = {}; this._handleBuffers = {}; this._aclOutQueue = []; @@ -527,7 +526,7 @@ class Hci extends EventEmitter { if (subEventType === EVT_DISCONN_COMPLETE) { handle = data.readUInt16LE(4); debug('\t\thandle = ' + handle); - if (handle !== this._mainHandle) { + if (this._handleAclsInProgress[handle] === undefined) { debug('\tignoring event because handle is unknown to bleno.'); debug('This might be OK in a multi role scenario in which the handle is part of a noble connection.'); return; @@ -543,7 +542,6 @@ class Hci extends EventEmitter { Controller for the returned Handle have been flushed, and that the corresponding data buffers have been freed. */ delete this._handleAclsInProgress[handle]; - this._mainHandle = null; const aclOutQueue = []; let discarded = 0; for (const i in this._aclOutQueue) { @@ -789,7 +787,6 @@ class Hci extends EventEmitter { debug('\t\t\tsupervision timeout = ' + supervisionTimeout); debug('\t\t\tmaster clock accuracy = ' + masterClockAccuracy); - this._mainHandle = handle; this._handleAclsInProgress[handle] = 0; this.emit('leConnComplete', status, handle, role, addressType, address, interval, latency, supervisionTimeout, masterClockAccuracy);