         }
         services = [HHService]()
     }
-    fileprivate var lastReannounce = Date.init(timeIntervalSince1970: 0)
     open var keepaliveTimer: Timer?
     open var lastReceivedData: Date = Date.init(timeIntervalSince1970: 0)
-    open var connectBlock: (()->Void)?
+    open var connect: (()->Void)?
     open var customData: [String:AnyHashable]? // store your own data here. When a browser finds an advertiser and creates a peer for it, this will be filled out with the advertiser's customData *even before any connection occurs*. Note that while you can store values that are AnyHashable, only Strings are used as values for advertiser->browser connections.
     var connectCount=0, disconnectCount=0, connectAttemptFailCount=0, connectAttemptFailAuthRejectCount=0, dataRecvCount=0, dataSendCount=0
     override open var description: String {

            if oldState == .awaitingAuth {
                peer.connectAttemptFailAuthRejectCount += 1
            }
            
            self.dispatch_on_delegate_queue({
                self.membershipRosterDelegate?.peerConnectionAttemptFailed?(peer.role, peer: peer, isAuthRejection: oldState == .awaitingAuth)
            })
        }

        guard let lastService = peer.pickedResolvedService(), let hhaddresses = lastService.resolvedAddressInfo else {
            DLog("socketDidDisconnect: not reannouncing, since last resolved service's resolvedAddressInfo is nil")
            return
        }
        
        if hhaddresses.count > 0 {
            if abs(peer.lastReannounce.timeIntervalSinceNow) > 2.0 {
                peer.lastReannounce = Date.init()
                DLog("\(peer.displayName) socketDidDisconnect: re-announcing now")
                self.announcePeer(peer: peer)
            } else {
                DLog("\(peer.displayName) socketDidDisconnect: NOT re-announcing, too quick")
            }
        } else {
            DLog("\(peer.displayName) socketDidDisconnect: not reannouncing, since there are no addresses")
        }
    }
    


@objc public protocol BluepeerMembershipRosterDelegate {
    @objc optional func peerDidConnect(_ peerRole: RoleType, peer: BPPeer)
    @objc optional func peerDidDisconnect(_ peerRole: RoleType, peer: BPPeer, canConnectNow: Bool) // canConnectNow: true if this peer is still announce-able, ie. can now call connect() on it
    @objc optional func peerConnectionAttemptFailed(_ peerRole: RoleType, peer: BPPeer?, isAuthRejection: Bool)
}

@objc public protocol BluepeerMembershipAdminDelegate {
    @objc optional func peerConnectionRequest(_ peer: BPPeer, invitationHandler: @escaping (Bool) -> Void) // was named: sessionConnectionRequest
    @objc optional func browserFoundPeer(_ role: RoleType, peer: BPPeer) // peer has connect() that can be executed, and your .customData too
    @objc optional func browserLostPeer(_ role: RoleType, peer: BPPeer)
}

