pub fn rendez_vous(&mut self, id: ClientId, client_state: ClientState) -> RendezVousResponse {
        info!("rendez vous: {}({})", id, client_state);
        if self.is_training_complete {
            return RendezVousResponse::Reject;
        }
        let response = match client_state {
            ClientState::Unknown => {
                // Accept new clients and make them selectable
                self.counters.waiting += 1;
                self.emit_event(Event::Accept(id));
                RendezVousResponse::Accept
            }
            ClientState::Waiting => {
                // The client should not re-send a rendez-vous
                // request, but that can be the case if it got
                // re-started so let's accept the client again.
                RendezVousResponse::Accept
            }
            ClientState::Selected => {
                // A selected/training client should not send us
                // a rendez-vous request. Let's not rely on it
                // for that round but still accept it for the
                // next round. The idea is to mitigate attacks
                // when many clients connect to the coordinator
                // and drop out once selected, while not
                // penalizing honest clients that had a
                // connectivity issue.
                self.counters.selected -= 1;
                self.counters.ignored += 1;
                self.emit_event(Event::SetState(id, ClientState::Ignored));
                RendezVousResponse::Accept
            }
            ClientState::DoneAndInactive | ClientState::Done => {
                // A client that has finished training may send
                // us a rendez-vous request if it is
                // restarted. This is problematic because we
                // cannot put them back in the "Waiting"
                // state, otherwise they might be selected
                // again for the current training round, to
                // which they already participated. Therefore,
                // we accept these clients but mark them as
                // "Ignored", to exclude them from the
                // selection process.
                self.counters.ignored += 1;
                self.emit_event(Event::SetState(id, ClientState::Ignored));
                RendezVousResponse::Accept
            }
            ClientState::Ignored => RendezVousResponse::Accept,
        };
        self.maybe_start_selection();
        response
    }
/// Handle a rendez-vous request for the given client.
///
/// # Returns
///
/// This method returns the response to send back to the client.
Handle a rendez-vous request for the given client.
Handle a rendez - vous request for the given client .
pub fn rendez_vous(&mut self, id: ClientId, client_state: ClientState) -> RendezVousResponse {
        info!("rendez vous: {}({})", id, client_state);
        if self.is_training_complete {
            return RendezVousResponse::Reject;
        }
        let response = match client_state {
            ClientState::Unknown => {
                // Accept new clients and make them selectable
                self.counters.waiting += 1;
                self.emit_event(Event::Accept(id));
                RendezVousResponse::Accept
            }
            ClientState::Waiting => {
                // The client should not re-send a rendez-vous
                // request, but that can be the case if it got
                // re-started so let's accept the client again.
                RendezVousResponse::Accept
            }
            ClientState::Selected => {
                // A selected/training client should not send us
                // a rendez-vous request. Let's not rely on it
                // for that round but still accept it for the
                // next round. The idea is to mitigate attacks
                // when many clients connect to the coordinator
                // and drop out once selected, while not
                // penalizing honest clients that had a
                // connectivity issue.
                self.counters.selected -= 1;
                self.counters.ignored += 1;
                self.emit_event(Event::SetState(id, ClientState::Ignored));
                RendezVousResponse::Accept
            }
            ClientState::DoneAndInactive | ClientState::Done => {
                // A client that has finished training may send
                // us a rendez-vous request if it is
                // restarted. This is problematic because we
                // cannot put them back in the "Waiting"
                // state, otherwise they might be selected
                // again for the current training round, to
                // which they already participated. Therefore,
                // we accept these clients but mark them as
                // "Ignored", to exclude them from the
                // selection process.
                self.counters.ignored += 1;
                self.emit_event(Event::SetState(id, ClientState::Ignored));
                RendezVousResponse::Accept
            }
            ClientState::Ignored => RendezVousResponse::Accept,
        };
        self.maybe_start_selection();
        response
    }
pub fn rendez_vous ( & mut self , id : ClientId , client_state : ClientState ) -> RendezVousResponse { info ! ( " " id client_state ) ; if self . is_training_complete { return RendezVousResponse :: Reject ; } let response = match client_state { ClientState :: Unknown => { // Accept new clients and make them selectable self . counters . waiting += 1 ; self . emit_event ( Event :: Accept ( id ) ) ; RendezVousResponse :: Accept } ClientState :: Waiting => { // The client should not re-send a rendez-vous // request, but that can be the case if it got // re-started so let's accept the client again. RendezVousResponse :: Accept } ClientState :: Selected => { // A selected/training client should not send us // a rendez-vous request. Let's not rely on it // for that round but still accept it for the // next round. The idea is to mitigate attacks // when many clients connect to the coordinator // and drop out once selected, while not // penalizing honest clients that had a // connectivity issue. self . counters . selected -= 1 ; self . counters . ignored += 1 ; self . emit_event ( Event :: SetState ( id , ClientState :: Ignored ) ) ; RendezVousResponse :: Accept } ClientState :: DoneAndInactive | ClientState :: Done => { // A client that has finished training may send // us a rendez-vous request if it is // restarted. This is problematic because we // cannot put them back in the "Waiting" // state, otherwise they might be selected // again for the current training round, to // which they already participated. Therefore, // we accept these clients but mark them as // "Ignored", to exclude them from the // selection process. self . counters . ignored += 1 ; self . emit_event ( Event :: SetState ( id , ClientState :: Ignored ) ) ; RendezVousResponse :: Accept } ClientState :: Ignored => RendezVousResponse :: Accept , } ; self . maybe_start_selection ( ) ; response }
Handle a rendez-vous request for the given client.
Handle a rendez - vous request for the given client .
&mut self
id
ClientId
client_state
ClientState
This method returns the response to send back to the client.
This method returns the response to send back to the client .
&mut self
id
ClientId
client_state
ClientState