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

This commit is contained in:
2025-12-17 19:07:10 +01:00
parent a38df76922
commit 25e8e1bb34

View File

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