Reapply "fix: Improve error handling in HTTP client and free socket pointer in worker thread"
This reverts commit 12de9d8c00.
This commit is contained in:
@@ -935,7 +935,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;
|
||||||
}
|
}
|
||||||
@@ -1774,6 +1776,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
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user