================
@@ -258,36 +259,33 @@ void DAP::SendJSON(const llvm::json::Value &json) {
   llvm::json::Path::Root root;
   if (!fromJSON(json, message, root)) {
     DAP_LOG_ERROR(log, root.getError(), "({1}) encoding failed: {0}",
-                  transport.GetClientName());
+                  m_client_name);
     return;
   }
   Send(message);
 }
 
 void DAP::Send(const Message &message) {
-  // FIXME: After all the requests have migrated from LegacyRequestHandler >
-  // RequestHandler<> this should be handled in RequestHandler<>::operator().
-  if (auto *resp = std::get_if<Response>(&message);
-      resp && debugger.InterruptRequested()) {
-    // Clear the interrupt request.
-    debugger.CancelInterruptRequest();
-
-    // If the debugger was interrupted, convert this response into a 
'cancelled'
-    // response because we might have a partial result.
-    Response cancelled{/*request_seq=*/resp->request_seq,
-                       /*command=*/resp->command,
-                       /*success=*/false,
-                       /*message=*/eResponseMessageCancelled,
-                       /*body=*/std::nullopt};
-    if (llvm::Error err = transport.Write(cancelled))
-      DAP_LOG_ERROR(log, std::move(err), "({1}) write failed: {0}",
-                    transport.GetClientName());
-    return;
+  if (const protocol::Event *event = std::get_if<protocol::Event>(&message)) {
+    transport.Event(*event);
+  } else if (const Request *req = std::get_if<Request>(&message)) {
+    transport.Request(*req);
+  } else if (const Response *resp = std::get_if<Response>(&message)) {
+    // FIXME: After all the requests have migrated from LegacyRequestHandler >
+    // RequestHandler<> this should be handled in RequestHandler<>::operator().
+    if (debugger.InterruptRequested())
+      // If the debugger was interrupted, convert this response into a
+      // 'cancelled' response because we might have a partial result.
+      transport.Response(Response{/*request_seq=*/resp->request_seq,
+                                  /*command=*/resp->command,
+                                  /*success=*/false,
+                                  /*message=*/eResponseMessageCancelled,
+                                  /*body=*/std::nullopt});
+    else
+      transport.Response(*resp);
----------------
ashgti wrote:

Done.

https://github.com/llvm/llvm-project/pull/153121
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to