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)
| 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 |
no test coverage detected