When tearDownSimulation() is called immediately after disconnection, the virtualConnections counter was first reset to 0, and then decremented. Hopefully, by checking the peripheral state this will happen less often. It's unlikely, that the peripheral would be in .disconnecting state just interval ms after tearing down the simulation. That seems to be the easiest "fix".
This PR should help with issue reported in #25.
When
tearDownSimulation()
is called immediately after disconnection, thevirtualConnections
counter was first reset to 0, and then decremented. Hopefully, by checking the peripheral state this will happen less often. It's unlikely, that the peripheral would be in.disconnecting
state justinterval
ms after tearing down the simulation. That seems to be the easiest "fix".