@@ -167,36 +167,51 @@ impl Transport {
167 client_tx: &UnboundedSender<Payload>,
167 client_tx: &UnboundedSender<Payload>,
168 msg: Payload,
168 msg: Payload,
169 ) -> Result<()> {
169 ) -> Result<()> {
170− let (id, result) = match msg {
170+ match msg {
171 Payload::Response(Response {
171 Payload::Response(Response {
172− success: true,
172+ ref success,
177− info!("<- DAP success ({}, in response to {})", seq, request_seq);
178− if let Payload::Response(val) = msg {
179− (request_seq, Ok(val))
184− Payload::Response(Response {
188 request_seq,
174 request_seq,
189− command,
175+ ref command,
192− error!(
180+ let result = match success {
182+ info!("<- DAP success ({}, in response to {})", seq, request_seq);
183+ if let Payload::Response(val) = msg {
193− "<- DAP error {:?} ({:?}) for command #{} {}",
191+ "<- DAP error {:?} ({:?}) for command #{} {}",
194− message, body, request_seq, command
192+ message, body, request_seq, command
198− Err(Error::Other(anyhow::format_err!("{:?}", body))),
195+ Err(Error::Other(anyhow::format_err!("{:?}", body)))
203+ .remove(&request_seq)
204+ .expect("pending_request with id not found!");
206+ match tx.send(result).await {
209+ "Tried sending response into a closed channel (id={:?}), original request likely timed out",
201 Payload::Request(Request {
216 Payload::Request(Request {
202 ref command,
217 ref command,
@@ -205,33 +220,16 @@ impl Transport {
206 info!("<- DAP request {} #{}", command, seq);
221 info!("<- DAP request {} #{}", command, seq);
207 client_tx.send(msg).expect("Failed to send");
222 client_tx.send(msg).expect("Failed to send");
208− return Ok(());
223+ Ok(())
210 Payload::Event(Event {
225 Payload::Event(Event {
211 ref event, ref seq, ..
226 ref event, ref seq, ..
213 info!("<- DAP event {} #{}", event, seq);
228 info!("<- DAP event {} #{}", event, seq);
214 client_tx.send(msg).expect("Failed to send");
229 client_tx.send(msg).expect("Failed to send");
215− return Ok(());
230+ Ok(())
224− .expect("pending_request with id not found!");
226− match tx.send(result).await {
229− "Tried sending response into a closed channel (id={:?}), original request likely timed out",
237 async fn recv(
235 async fn recv(