     
     public func socket(_ sock: GCDAsyncSocket, didWritePartialDataOfLength partialLength: UInt, tag: Int) {
         guard let peer = sock.peer else {
-            assert(false, "BluepeerObject: programming error, expected to find a peer in didWritePartialDataOfLength")
             return
         }
         self.scheduleNextKeepaliveTimer(peer)

            peer.dnsService = nil
            peer.state = .notConnected
            peer.announced = false
        }
        self.killAllKeepaliveTimers()
        self.peers = [] // remove all peers!
    }
    

    
    deinit {
        NotificationCenter.default.removeObserver(self)
        self.killAllKeepaliveTimers() // probably moot: won't start deiniting until all timers are dead, because they have a strong ref to self
        self.disconnectSession()
        self.stopBrowsing()
        self.stopAdvertising()
        NSLog("BluepeerObject: DEINIT FINISH")
        self.endBackgroundTask()
    }
    
    // Note: if I disconnect, then my delegate is expected to reconnect if needed.
    func didEnterBackground() {
        self.backgroundTask = UIApplication.shared.beginBackgroundTask(withName: "BluepeerBackgroundedTask", expirationHandler: {
            self.endBackgroundTask()
        })
        self.onLastBackground = (self.advertising, self.browsing)
        stopBrowsing()
        stopAdvertising()
