diff --git a/src/BluetoothHciSocket.cpp b/src/BluetoothHciSocket.cpp index bc4ed6f..1c0e69e 100644 --- a/src/BluetoothHciSocket.cpp +++ b/src/BluetoothHciSocket.cpp @@ -583,6 +583,11 @@ void BluetoothHciSocket::SetFilter(const Napi::CallbackInfo& info) { } void BluetoothHciSocket::Start(const Napi::CallbackInfo& info) { + if (!stopFlag && pollingThread.joinable()) { + stopFlag = true; + pollingThread.join(); + } + if (!this->EnsureSocket(info)) { return; }