What was happening is that if a disconnect occurs right after the discoverServices(nil) call and the discovery response was not yet received, future discoverServices calls will never return anything because the remainingServicesDiscoveryRequest is unbalanced (it was incremented but it was never decremented because of the disconnect event).
It is the same problem for discoverCharacteristics and discoverIncludedServices.
This is related to this issue.
What was happening is that if a disconnect occurs right after the
discoverServices(nil)
call and the discovery response was not yet received, futurediscoverServices
calls will never return anything because theremainingServicesDiscoveryRequest
is unbalanced (it was incremented but it was never decremented because of the disconnect event).It is the same problem for
discoverCharacteristics
anddiscoverIncludedServices
.