         }
         services = [HHService]()
     }
+    fileprivate var lastInterfaceNameChosenForConnect: String?
     open var keepaliveTimer: Timer?
     open var lastReceivedData: Date = Date.init(timeIntervalSince1970: 0)
     open var connect: (()->Void)?

        peer.socket = nil
        sock.synchronouslySetDelegate(nil)
        
        // is it still valid to call connect() on this peer?
        var canConnectNow = false
        if let lastService = peer.pickedResolvedService(),
            let hhaddresses = lastService.resolvedAddressInfo,
            hhaddresses.count > 0 {
            canConnectNow = true
        }
        
        switch oldState {
        case .authenticated:
            peer.disconnectCount += 1
            self.dispatch_on_delegate_queue({
                self.membershipRosterDelegate?.peerDidDisconnect?(peer.role, peer: peer, canConnectNow: canConnectNow)
            })
        case .notConnected:
            assert(false, "ERROR: state is being tracked wrong")

            DLog(" socketDidDisconnect: WARNING expected to find 1 peer with this socket but found \(matchingPeers.count), calling peerConnectionAttemptFailed")
            sock.synchronouslySetDelegate(nil)
            self.dispatch_on_delegate_queue({
                self.membershipRosterDelegate?.peerConnectionAttemptFailed?(.unknown, peer: nil, isAuthRejection: false, canConnectNow: false)
            })
            return
        }
