diff --git a/implementations/rust/ockam/ockam_api/src/nodes/service.rs b/implementations/rust/ockam/ockam_api/src/nodes/service.rs index ffecfede291..553190d68a7 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/service.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/service.rs @@ -720,7 +720,7 @@ impl NodeManagerWorker { (Get, ["node", "forwarder", remote_address]) => { encode_request_result(self.show_forwarder(req, remote_address).await)? } - (Get, ["node", "forwarder"]) => self.get_forwarders_response(req).await.to_vec()?, + (Get, ["node", "forwarder"]) => encode_request_result(self.get_forwarders(req).await)?, (Delete, ["node", "forwarder", remote_address]) => { encode_request_result(self.delete_forwarder(ctx, req, remote_address).await)? } diff --git a/implementations/rust/ockam/ockam_api/src/nodes/service/forwarder.rs b/implementations/rust/ockam/ockam_api/src/nodes/service/forwarder.rs index 7a7626e864a..dfe5c156796 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/service/forwarder.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/service/forwarder.rs @@ -52,8 +52,8 @@ impl NodeManagerWorker { } } - pub(super) async fn delete_forwarder( - &mut self, + pub async fn delete_forwarder( + &self, ctx: &mut Context, req: &RequestHeader, remote_address: &str, @@ -63,28 +63,27 @@ impl NodeManagerWorker { .await } - pub(super) async fn show_forwarder( - &mut self, + pub async fn show_forwarder( + &self, req: &RequestHeader, remote_address: &str, ) -> Result>, Response> { self.node_manager.show_forwarder(req, remote_address).await } - pub async fn get_forwarders(&self) -> Vec { - self.node_manager.get_forwarders().await - } - - pub(super) async fn get_forwarders_response( + pub async fn get_forwarders( &self, req: &RequestHeader, - ) -> Response> { + ) -> Result>, Response> { debug!("Handling ListForwarders request"); - Response::ok(req).body(self.get_forwarders().await) + Ok(Response::ok(req).body(self.node_manager.get_forwarders().await)) } } impl NodeManager { + + /// This function returns a representation of the relays currently + /// registered on this node pub async fn get_forwarders(&self) -> Vec { let forwarders = self .registry