/// Handle an incoming request from the validator
Handle an incoming request from the validator
Handle an incoming request from the validator
fn handle_request(&mut self) -> Result<bool, KmsError> {
        debug!("started handling request ... ");
        let response = match Request::read(&mut self.connection)? {
            Request::SignProposal(req) => self.sign(req)?,
            Request::SignVote(req) => self.sign(req)?,
            // non-signable requests:
            Request::ReplyPing(ref req) => self.reply_ping(req),
            Request::ShowPublicKey(ref req) => self.get_public_key(req)?,
            Request::PoisonPill(_req) => return Ok(false),
        };
        let mut buf = vec![];
        match response {
            Response::SignedProposal(sp) => sp.encode(&mut buf)?,
            Response::SignedVote(sv) => sv.encode(&mut buf)?,
            Response::Ping(ping) => ping.encode(&mut buf)?,
            Response::PublicKey(pk) => pk.encode(&mut buf)?,
        }
        self.connection.write_all(&buf)?;
        debug!("... success handling request");
        Ok(true)
    }
fn handle_request ( & mut self ) -> Result < bool , KmsError > { debug ! ( " " ) ; let response = match Request :: read ( & mut self . connection ) ? { Request :: SignProposal ( req ) => self . sign ( req ) ? , Request :: SignVote ( req ) => self . sign ( req ) ? , // non-signable requests: Request :: ReplyPing ( ref req ) => self . reply_ping ( req ) , Request :: ShowPublicKey ( ref req ) => self . get_public_key ( req ) ? , Request :: PoisonPill ( _req ) => return Ok ( false ) , } ; let mut buf = vec ! [ ] ; match response { Response :: SignedProposal ( sp ) => sp . encode ( & mut buf ) ? , Response :: SignedVote ( sv ) => sv . encode ( & mut buf ) ? , Response :: Ping ( ping ) => ping . encode ( & mut buf ) ? , Response :: PublicKey ( pk ) => pk . encode ( & mut buf ) ? , } self . connection . write_all ( & buf ) ? ; debug ! ( " " ) ; Ok ( true ) }
Handle an incoming request from the validator
Handle an incoming request from the validator
&mut self