| 402 | } |
| 403 | |
| 404 | void Server::accept_connections() { |
| 405 | sockaddr_in client_addr{}; |
| 406 | socklen_t addr_len = sizeof(client_addr); |
| 407 | |
| 408 | // Accept all pending connections (non-blocking) |
| 409 | while (true) { |
| 410 | int client_fd = accept(mListenSocket, |
| 411 | (sockaddr*)(&client_addr), |
| 412 | &addr_len); |
| 413 | |
| 414 | if (client_fd < 0) { |
| 415 | #ifdef FL_IS_WIN |
| 416 | if (WSAGetLastError() == SOCKET_ERROR_WOULD_BLOCK) break; |
| 417 | #else |
| 418 | if (errno == EWOULDBLOCK || errno == EAGAIN) break; |
| 419 | #endif |
| 420 | // Other error - log and continue |
| 421 | break; |
| 422 | } |
| 423 | |
| 424 | // Set client socket to non-blocking |
| 425 | if (!set_nonblocking(client_fd)) { |
| 426 | close(client_fd); |
| 427 | continue; |
| 428 | } |
| 429 | |
| 430 | // Add to client list |
| 431 | ClientConnection client; |
| 432 | client.fd = client_fd; |
| 433 | client.connect_time = fl::platforms::millis(); |
| 434 | mClientSockets.push_back(client); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | size_t Server::process_requests() { |
| 439 | size_t requests_processed = 0; |
nothing calls this directly
no test coverage detected