Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log as warning for socket connect and client bootstrap #594

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
}

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) {
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
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