fix: send_reponse err handling

master
Sean McBride 3 years ago
parent 569fdd39ea
commit acff35683a

@ -40,7 +40,7 @@ typedef void (*void_cb)(void);
* @param client_socket - the client we are rejecting
* @param buffer - buffer to write to socket
* @param on_eagain - cb to execute when client socket returns EAGAIN. If NULL, error out
* @returns 0
* @returns 0 on success, -1 on error.
*/
static inline int
client_socket_send(int client_socket, const char *buffer, size_t buffer_len, void_cb on_eagain)

@ -40,9 +40,12 @@ current_sandbox_send_response()
sandbox->total_time = end_time - sandbox->timestamp_of.request_arrival;
/* Send HTTP Response Header and Body */
http_header_200_write(sandbox->client_socket_descriptor, module_content_type, response_body_size);
client_socket_send(sandbox->client_socket_descriptor, (const char *)response->buffer, response_body_size,
current_sandbox_sleep);
rc = http_header_200_write(sandbox->client_socket_descriptor, module_content_type, response_body_size);
if (rc < 0) goto err;
rc = client_socket_send(sandbox->client_socket_descriptor, (const char *)response->buffer, response_body_size,
current_sandbox_sleep);
if (rc < 0) goto err;
http_total_increment_2xx();
rc = 0;

Loading…
Cancel
Save