pub fn receive_channel(&mut self, m: Message) -> Result<(), String> {
        self.channel_address = m.return_route.addresses[0].address.clone();
        self.onward_route
            .addresses
            .push(RouterAddress::worker_router_address_from_str("01020304").unwrap());
        let pending_opt = self.pending_message.clone();
        match pending_opt {
            Some(mut pending) => {
                pending.onward_route.addresses.insert(
                    0,
                    RouterAddress::from_address(self.channel_address.clone()).unwrap(),
                );
                pending.return_route = Route {
                    addresses: vec![RouterAddress::from_address(self.address.clone()).unwrap()],
                };
                self.router_tx
                    .send(OckamCommand::Router(RouterCommand::SendMessage(pending)))
                    .unwrap();
                self.pending_message = None;
                Ok(())
            }
            _ => Ok(()),
        }
    }
// This function is called when a key exchange has been completed and a secure
// channel created. If it was requested by the worker, as in the case of an
// initiator, the worker address should be non-zero. If it was not requested,
// as in the case of a responder, the worker address may be zero, in which case the
// worker manager should either create a new worker, or bail.
This function is called when a key exchange has been completed and a secure
channel created. If it was requested by the worker, as in the case of an
initiator, the worker address should be non-zero. If it was not requested,
as in the case of a responder, the worker address may be zero, in which case the
worker manager should either create a new worker, or bail.
This function is called when a key exchange has been completed and a secure channel created . If it was requested by the worker as in the case of an initiator the worker address should be non - zero . If it was not requested as in the case of a responder the worker address may be zero in which case the worker manager should either create a new worker or bail .
pub fn receive_channel(&mut self, m: Message) -> Result<(), String> {
        self.channel_address = m.return_route.addresses[0].address.clone();
        self.onward_route
            .addresses
            .push(RouterAddress::worker_router_address_from_str("01020304").unwrap());
        let pending_opt = self.pending_message.clone();
        match pending_opt {
            Some(mut pending) => {
                pending.onward_route.addresses.insert(
                    0,
                    RouterAddress::from_address(self.channel_address.clone()).unwrap(),
                );
                pending.return_route = Route {
                    addresses: vec![RouterAddress::from_address(self.address.clone()).unwrap()],
                };
                self.router_tx
                    .send(OckamCommand::Router(RouterCommand::SendMessage(pending)))
                    .unwrap();
                self.pending_message = None;
                Ok(())
            }
            _ => Ok(()),
        }
    }
pub fn receive_channel ( & mut self , m : Message ) -> Result < ( ) , String > { self . channel_address = m . return_route . addresses [ 0 ] . address . clone ( ) ; self . onward_route . addresses . push ( RouterAddress :: worker_router_address_from_str ( " " ) . unwrap ( ) ) ; let pending_opt = self . pending_message . clone ( ) ; match pending_opt { Some ( mut pending ) => { pending . onward_route . addresses . insert ( 0 , RouterAddress :: from_address ( self . channel_address . clone ( ) ) . unwrap ( ) , ) ; pending . return_route = Route { addresses : vec ! [ RouterAddress from_address ( self address clone ( ) ) unwrap ( ) ] , } ; self . router_tx . send ( OckamCommand :: Router ( RouterCommand :: SendMessage ( pending ) ) ) . unwrap ( ) ; self . pending_message = None ; Ok ( ( ) ) } _ => Ok ( ( ) ) , } }
This function is called when a key exchange has been completed and a secure
channel created.
This function is called when a key exchange has been completed and a secure channel created .
&mut self
m
Message
&mut self
m
Message