MCPcopy Create free account
hub / github.com/Lovrom8/RSMods / SendResponse

Function SendResponse

DLL/CC/ControlServer.cpp:66–80  ·  view source on GitHub ↗

Sends a response through the same socket it received the request from If the effect was started, it sends a Response with code 0 (Success), otherwise it sends a Response with code 3 (Retry)

Source from the content-addressed store, hash-verified

64 /// If the effect was started, it sends a Response with code 0 (Success), otherwise it sends a Response with code 3 (Retry)
65 /// </summary>
66 void SendResponse(const Response& response) {
67 //Serialize response
68 json j;
69 CrowdControl::Structs::to_json_response(j, response);
70 std::string jsonstr = j.dump();
71
72 LOG_INFO("Responding: " << jsonstr.c_str() << std::endl);
73
74 //Send response
75 send(sock, jsonstr.c_str(), jsonstr.length(), NULL);
76
77 //Send null terminator
78 char buffer[1] = { 0 };
79 send(sock, buffer, sizeof(buffer), NULL);
80 }
81
82 /// <summary>
83 /// Waits for incoming requests, which are null terminated

Callers 1

ClientLoopFunction · 0.85

Calls 3

to_json_responseFunction · 0.85
dumpMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected