/// Process ACK response for the REGISTER command.
Process ACK response for the REGISTER command.
Process ACK response for the REGISTER command .
fn process_handshake_ack(
        &mut self, 
        msg: &[u8],
        event_loop: &mut EventLoop<Self>) -> SocketEventResult {
        if self.state == ProtocolState::Handshake {
            let ack = try_arr!(control::parse_ack_message(msg));
            if ack == ACK_NO_ERROR {
                // switch the protocol state into normal operation
                self.state = ProtocolState::Established;
                // start sending update messages
                event_loop.timeout_ms(TimerEvent::Update, UPDATE_CHECK_PERIOD)
                    .unwrap();
                // start sending PING messages
                event_loop.timeout_ms(TimerEvent::Ping, PING_PERIOD)
                    .unwrap();
                let diagnostic_mode = self.app_context.lock()
                    .unwrap()
                    .diagnostic_mode;
                // report a fake redirect in case of the diagnostic mode
                if diagnostic_mode {
                    Ok(Some(String::new()))
                } else {
                    Ok(None)
                }
            } else if ack == ACK_UNAUTHORIZED {
                Err(ArrowError::unauthorized("Arrow REGISTER failed (unauthorized)"))
            } else if ack == ACK_UNSUPPORTED_PROTOCOL_VERSION {
                Err(ArrowError::unsupported_protocol_version("Arrow REGISTER failed (unsupported version of the Arrow Protocol)"))
            } else if ack == ACK_INTERNAL_SERVER_ERROR {
                Err(ArrowError::arrow_server_error("Arrow REGISTER failed (internal server error)"))
            } else {
                Err(ArrowError::other("Arrow REGISTER failed (unknown error)"))
            }
        } else {
            panic!("unexpected protocol state");
        }
    }
fn process_handshake_ack ( & mut self , msg : & [ u8 ] , event_loop : & mut EventLoop < Self > ) -> SocketEventResult { if self . state == ProtocolState :: Handshake { let ack = try_arr ! ( control parse_ack_message ( msg ) ) ; if ack == ACK_NO_ERROR { // switch the protocol state into normal operation self . state = ProtocolState :: Established ; // start sending update messages event_loop . timeout_ms ( TimerEvent :: Update , UPDATE_CHECK_PERIOD ) . unwrap ( ) ; // start sending PING messages event_loop . timeout_ms ( TimerEvent :: Ping , PING_PERIOD ) . unwrap ( ) ; let diagnostic_mode = self . app_context . lock ( ) . unwrap ( ) . diagnostic_mode ; // report a fake redirect in case of the diagnostic mode if diagnostic_mode { Ok ( Some ( String :: new ( ) ) ) } else { Ok ( None ) } } else if ack == ACK_UNAUTHORIZED { Err ( ArrowError :: unauthorized ( " " ) ) } else if ack == ACK_UNSUPPORTED_PROTOCOL_VERSION { Err ( ArrowError :: unsupported_protocol_version ( " " ) ) } else if ack == ACK_INTERNAL_SERVER_ERROR { Err ( ArrowError :: arrow_server_error ( " " ) ) } else { Err ( ArrowError :: other ( " " ) ) } } else { panic ! ( " " ) ; } }
Process ACK response for the REGISTER command.
Process ACK response for the REGISTER command .
&mut self
msg
&[u8]
event_loop
&mut EventLoop<Self>