diff options
Diffstat (limited to 'helix-dap/src/transport.rs')
-rw-r--r-- | helix-dap/src/transport.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/helix-dap/src/transport.rs b/helix-dap/src/transport.rs index 3f4eec43..40474e99 100644 --- a/helix-dap/src/transport.rs +++ b/helix-dap/src/transport.rs @@ -55,7 +55,7 @@ impl Transport { server_stdin: Box<dyn AsyncWrite + Unpin + Send>, server_stderr: Option<Box<dyn AsyncBufRead + Unpin + Send>>, id: usize, - ) -> (UnboundedReceiver<Payload>, UnboundedSender<Request>) { + ) -> (UnboundedReceiver<Payload>, UnboundedSender<Payload>) { let (client_tx, rx) = unbounded_channel(); let (tx, client_rx) = unbounded_channel(); @@ -140,14 +140,14 @@ impl Transport { async fn send_payload_to_server( &self, server_stdin: &mut Box<dyn AsyncWrite + Unpin + Send>, - mut req: Request, + mut payload: Payload, ) -> Result<()> { - let back_ch = req.back_ch.take(); - let seq = req.seq; - let json = serde_json::to_string(&Payload::Request(req))?; - if let Some(back) = back_ch { - self.pending_requests.lock().await.insert(seq, back); + if let Payload::Request(request) = &mut payload { + if let Some(back) = request.back_ch.take() { + self.pending_requests.lock().await.insert(request.seq, back); + } } + let json = serde_json::to_string(&payload)?; self.send_string_to_server(server_stdin, json).await } @@ -254,11 +254,11 @@ impl Transport { async fn send( transport: Arc<Self>, mut server_stdin: Box<dyn AsyncWrite + Unpin + Send>, - mut client_rx: UnboundedReceiver<Request>, + mut client_rx: UnboundedReceiver<Payload>, ) { - while let Some(req) = client_rx.recv().await { + while let Some(payload) = client_rx.recv().await { transport - .send_payload_to_server(&mut server_stdin, req) + .send_payload_to_server(&mut server_stdin, payload) .await .unwrap() } |