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

Method process_requests

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

Source from the content-addressed store, hash-verified

436}
437
438size_t Server::process_requests() {
439 size_t requests_processed = 0;
440
441 // Process all clients (iterate backwards to allow removal)
442 for (size_t i = mClientSockets.size(); i > 0; --i) {
443 size_t index = i - 1;
444 ClientConnection& client = mClientSockets[index];
445
446 // Try to read request
447 optional<Request> req = read_request(client);
448 if (!req) {
449 continue; // No complete request yet
450 }
451
452 // Find handler
453 optional<RouteHandler> handler = find_handler(req->method(), req->path());
454
455 Response resp;
456 if (handler) {
457 // Call handler
458 resp = (*handler)(*req);
459 } else {
460 // No handler found - 404
461 resp = Response::not_found();
462 }
463
464 // Send response
465 send_response(client.fd, resp);
466
467 // Close connection (HTTP/1.0 - no keep-alive)
468 close_client(index);
469
470 requests_processed++;
471 }
472
473 return requests_processed;
474}
475
476optional<Request> Server::read_request(ClientConnection& client) {
477 // Read data from socket

Callers

nothing calls this directly

Calls 3

methodMethod · 0.80
sizeMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected