Move `hasConnected` property to an instance variable

Add the `volatile` qualifier