MCPcopy Create free account
hub / github.com/SpartanJ/eepp / makeRequest

Method makeRequest

src/tools/ecode/plugins/debugger/dap/debuggerclientdap.cpp:48–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void DebuggerClientDap::makeRequest( const std::string_view& command,
49 const nlohmann::json& arguments, ResponseHandler onFinish,
50 const SessionId& sessionId ) {
51 auto& session = mSessions[sessionId];
52
53 nlohmann::json jsonCmd = {
54 { "seq", session.idx.load() },
55 { "type", "request" },
56 { "command", command },
57 { "arguments", arguments.empty() ? nlohmann::json::object() : arguments } };
58
59 std::string cmd = jsonCmd.dump();
60 std::string msg( String::format( "Content-Length: %zu\r\n\r\n%s", cmd.size(), cmd ) );
61
62 if ( mDebug ) {
63 Log::debug( "DebuggerClientDap::makeRequest [Session %s]:", sessionId );
64 Log::debug( msg );
65 }
66
67 if ( !session.bus )
68 return;
69
70 session.bus->write( msg.data(), msg.size() );
71
72 Lock l( mRequestsMutex );
73 mRequests[session.idx] = { std::string{ command }, arguments, onFinish, sessionId };
74 session.idx.fetch_add( 1, std::memory_order_relaxed );
75}
76
77void DebuggerClientDap::makeResponse( int reqSeq, bool success, const std::string& command,
78 const nlohmann::json& body, const std::string& sessionId ) {

Callers

nothing calls this directly

Calls 7

formatFunction · 0.85
debugFunction · 0.85
loadMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected