| 283 | } |
| 284 | |
| 285 | async fn close( |
| 286 | &self, |
| 287 | request: tonic::Request<pb::CloseRequest>, |
| 288 | ) -> Result<tonic::Response<pb::CloseResponse>, tonic::Status> { |
| 289 | let req = request.into_inner(); |
| 290 | let req: requests::CloseRequest = req.into(); |
| 291 | debug!("Client asked for close"); |
| 292 | trace!("close request: {:?}", req); |
| 293 | let mut rpc = ClnRpc::new(&self.rpc_path) |
| 294 | .await |
| 295 | .map_err(|e| Status::new(Code::Internal, e.to_string()))?; |
| 296 | let result = rpc.call(Request::Close(req)) |
| 297 | .await |
| 298 | .map_err(|e| Status::new( |
| 299 | Code::Unknown, |
| 300 | format!("Error calling method Close: {:?}", e)))?; |
| 301 | match result { |
| 302 | Response::Close(r) => { |
| 303 | trace!("close response: {:?}", r); |
| 304 | Ok(tonic::Response::new(r.into())) |
| 305 | }, |
| 306 | r => Err(Status::new( |
| 307 | Code::Internal, |
| 308 | format!( |
| 309 | "Unexpected result {:?} to method call Close", |
| 310 | r |
| 311 | ) |
| 312 | )), |
| 313 | } |
| 314 | |
| 315 | } |
| 316 | |
| 317 | async fn connect_peer( |
| 318 | &self, |