Reapply "fix: Improve error handling in HTTP client and free socket pointer in worker thread"

This reverts commit 12de9d8c00.
This commit is contained in:
2025-12-17 20:28:35 +01:00
parent 12de9d8c00
commit 519f5e13c8

View File

@@ -935,7 +935,9 @@ void* handle_http_client(void* arg)
{
ssize_t sent = send(client_socket, (char*)data_to_send + total_sent,
size_to_send - total_sent, 0);
if (sent <= 0)
if (sent == -1)
perror("Send failed!");
else if (sent <= 0)
break;
total_sent += sent;
}
@@ -1774,6 +1776,7 @@ void* worker_thread(void* arg)
*socket_ptr = task->socket_fd;
handle_https_client(socket_ptr);
}
free(socket_ptr);
}
else
{