             peer.socket?.delegate = nil // we don't want to run our disconnection logic below
             peer.socket?.disconnect()
             peer.socket = nil
+            peer.dnsService?.endResolve()
             peer.dnsService = nil
             peer.state = .notConnected
+            peer.announced = false
         }
         self.killAllKeepaliveTimers()
         self.peers = [] // remove all peers!

    public func serviceBrowser(_ serviceBrowser: HHServiceBrowser, didRemove service: HHService, moreComing: Bool) {
        NSLog("BluepeerObject: didRemoveService \(service.name)")
        if let peer = self.peers.filter({ $0.dnsService == service }).first {
            peer.dnsService = nil
            peer.announced = false
            self.dispatch_on_delegate_queue({

        self.browser = nil
        self.browsing = false
        for peer in self.peers {
            peer.dnsService?.endResolve()
            peer.dnsService = nil
            peer.announced = false
        }
    }
    
