Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Aug 18, 2023
1 parent 4ba58c0 commit 3f3d037
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
9 changes: 8 additions & 1 deletion source/channel_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,18 @@ static void s_attempt_connection(struct aws_task *task, void *arg, enum aws_task
if (task_data->args->failed_count == task_data->args->addresses_count) {
AWS_LOGF_ERROR(
AWS_LS_IO_CHANNEL_BOOTSTRAP,
"id=%p: failed to create socket with error %d",
"id=%p: Last attempt failed to create socket with error %d",
(void *)task_data->args->bootstrap,
err_code);
s_connection_args_setup_callback(task_data->args, err_code, NULL);
} else {
AWS_LOGF_DEBUG(
AWS_LS_IO_CHANNEL_BOOTSTRAP,
"id=%p: failed to create socket with error %d. More attempts ongoing.",
(void *)task_data->args->bootstrap,
err_code);
}

s_client_connection_args_release(task_data->args);

cleanup_task:
Expand Down
10 changes: 5 additions & 5 deletions source/posix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int s_on_connection_success(struct aws_socket *socket) {

if (getsockopt(socket->io_handle.data.fd, SOL_SOCKET, SO_ERROR, &connect_result, &result_length) < 0) {
int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: failed to determine connection error %d",
(void *)socket,
Expand All @@ -397,7 +397,7 @@ static int s_on_connection_success(struct aws_socket *socket) {
}

if (connect_result) {
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: connection error %d",
(void *)socket,
Expand Down Expand Up @@ -437,7 +437,7 @@ static int s_on_connection_success(struct aws_socket *socket) {

static void s_on_connection_error(struct aws_socket *socket, int error) {
socket->state = ERROR;
AWS_LOGF_ERROR(AWS_LS_IO_SOCKET, "id=%p fd=%d: connection failure", (void *)socket, socket->io_handle.data.fd);
AWS_LOGF_DEBUG(AWS_LS_IO_SOCKET, "id=%p fd=%d: connection failure", (void *)socket, socket->io_handle.data.fd);
if (socket->connection_result_fn) {
socket->connection_result_fn(socket, error, socket->connect_accept_user_data);
} else if (socket->accept_result_fn) {
Expand Down Expand Up @@ -674,7 +674,7 @@ int aws_socket_connect(

if (pton_err != 1) {
int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: failed to parse address %s:%d.",
(void *)socket,
Expand Down Expand Up @@ -770,7 +770,7 @@ int aws_socket_connect(
(unsigned long long)timeout);
aws_event_loop_schedule_task_future(event_loop, timeout_task, timeout);
} else {
AWS_LOGF_WARN(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: connect failed with error code %d.",
(void *)socket,
Expand Down
16 changes: 8 additions & 8 deletions source/windows/iocp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ static int s_ipv4_stream_connection_success(struct aws_socket *socket) {
if (getsockopt(
(SOCKET)socket->io_handle.data.handle, SOL_SOCKET, SO_ERROR, (char *)&connect_result, &result_length) < 0) {
int wsa_err = WSAGetLastError(); /* logging may reset error, so cache it */
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: failed to determine connection error %d",
(void *)socket,
Expand All @@ -690,7 +690,7 @@ static int s_ipv4_stream_connection_success(struct aws_socket *socket) {
}

if (connect_result) {
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: connection error %d",
(void *)socket,
Expand Down Expand Up @@ -740,7 +740,7 @@ static int s_ipv6_stream_connection_success(struct aws_socket *socket) {
if (getsockopt(
(SOCKET)socket->io_handle.data.handle, SOL_SOCKET, SO_ERROR, (char *)&connect_result, &result_length) < 0) {
int wsa_err = WSAGetLastError(); /* logging may reset error, so cache it */
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: failed to determine connection error %d",
(void *)socket,
Expand All @@ -751,7 +751,7 @@ static int s_ipv6_stream_connection_success(struct aws_socket *socket) {
}

if (connect_result) {
AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: connection error %d",
(void *)socket,
Expand Down Expand Up @@ -806,7 +806,7 @@ static int s_local_and_udp_connection_success(struct aws_socket *socket) {
static void s_connection_error(struct aws_socket *socket, int error) {
socket->state = ERRORED;

AWS_LOGF_ERROR(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: connection error with code %d",
(void *)socket,
Expand Down Expand Up @@ -988,7 +988,7 @@ static inline int s_tcp_connect(
if (!connect_res) {
int error_code = WSAGetLastError();
if (error_code != ERROR_IO_PENDING) {
AWS_LOGF_WARN(
AWS_LOGF_DEBUG(
AWS_LS_IO_TLS,
"id=%p handle=%p: connection error %d",
(void *)socket,
Expand Down Expand Up @@ -1220,7 +1220,7 @@ static int s_local_connect(

error:;
int win_error = GetLastError(); /* logging may reset error, so cache it */
AWS_LOGF_WARN(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: failed to connect to named pipe %s.",
(void *)socket,
Expand Down Expand Up @@ -1267,7 +1267,7 @@ static inline int s_dgram_connect(

if (connect_err) {
int wsa_err = WSAGetLastError(); /* logging may reset error, so cache it */
AWS_LOGF_WARN(
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: Failed to connect to %s:%d with error %d.",
(void *)socket,
Expand Down

0 comments on commit 3f3d037

Please sign in to comment.