Ignore socket events when an HTTP response is being built by the user

This commit is contained in:
2025-12-03 18:40:26 +01:00
parent f6d81c1a87
commit e686e477e2
5 changed files with 64 additions and 0 deletions
+6
View File
@@ -144,6 +144,9 @@ check_request_buffer(HTTP_Server *server, HTTP_ServerConn *conn)
// Ready
assert(ret > 0);
// Stop receiving I/O events while we are building the response
socket_silent(&server->sockets, conn->handle, true);
conn->state = HTTP_SERVER_CONN_WAIT_STATUS;
conn->request_len = ret;
conn->response_offset = byte_queue_offset(&conn->output);
@@ -574,5 +577,8 @@ void http_response_builder_send(HTTP_ResponseBuilder builder)
conn->state = HTTP_SERVER_CONN_FLUSHING;
conn->gen++;
// Enable back I/O events
socket_silent(&builder.server->sockets, conn->handle, false);
http_server_conn_process_events(builder.server, conn);
}