MCPcopy Create free account
hub / github.com/FastLED/FastLED / send_response

Method send_response

src/fl/stl/asio/http/server.cpp.hpp:570–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570bool Server::send_response(int client_fd, const Response& response) {
571 string data = response.to_string();
572 const char* ptr = data.c_str();
573 size_t remaining = data.size();
574
575 while (remaining > 0) {
576#ifdef FL_IS_WIN
577 int sent = send(client_fd, ptr, static_cast<int>(remaining), 0);
578#else
579 ssize_t sent = send(client_fd, ptr, remaining, 0);
580#endif
581
582 if (sent <= 0) {
583 return false;
584 }
585
586 ptr += sent;
587 remaining -= static_cast<size_t>(sent);
588 }
589
590 return true;
591}
592
593optional<RouteHandler> Server::find_handler(const string& method, const string& path) const {
594 for (const auto& entry : mRoutes) {

Callers 3

do_GETMethod · 0.80
send_json_responseMethod · 0.80
send_text_responseMethod · 0.80

Calls 4

sendFunction · 0.50
to_stringMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by 2

send_json_responseMethod · 0.64
send_text_responseMethod · 0.64