From 69c22b4a6c1b7e1c4dbb064d2d5324ac65afe410 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Fri, 8 Nov 2024 12:03:11 -0800 Subject: [PATCH] clean up merge changes --- include/aws/io/socket.h | 1 - source/darwin/nw_socket.c | 10 ++++------ source/posix/socket.c | 1 - source/socket.c | 2 -- source/windows/iocp/socket.c | 1 - 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/aws/io/socket.h b/include/aws/io/socket.h index 9a6d8110f..01c83084c 100644 --- a/include/aws/io/socket.h +++ b/include/aws/io/socket.h @@ -164,7 +164,6 @@ struct aws_socket { struct aws_event_loop *event_loop; struct aws_channel_handler *handler; int state; - enum aws_event_loop_style event_loop_style; aws_socket_on_readable_fn *readable_fn; void *readable_user_data; aws_socket_on_connection_result_fn *connection_result_fn; diff --git a/source/darwin/nw_socket.c b/source/darwin/nw_socket.c index 6a4ce4ba4..a54367aa5 100644 --- a/source/darwin/nw_socket.c +++ b/source/darwin/nw_socket.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -17,7 +18,6 @@ #include #include -#ifdef AWS_USE_DISPATCH_QUEUE static int s_determine_socket_error(int error) { switch (error) { case ECONNREFUSED: @@ -355,7 +355,6 @@ int aws_socket_init(struct aws_socket *socket, struct aws_allocator *alloc, cons socket->options = *options; socket->impl = nw_socket; socket->vtable = &s_vtable; - socket->event_loop_style = AWS_EVENT_LOOP_STYLE_COMPLETION_PORT_BASED; aws_mutex_init(&nw_socket->synced_data.lock); aws_mutex_lock(&nw_socket->synced_data.lock); @@ -833,7 +832,7 @@ static int s_socket_connect_fn( socket->io_handle.set_queue = s_client_set_dispatch_queue; socket->io_handle.clear_queue = s_client_clear_dispatch_queue; - aws_event_loop_connect_handle_to_completion_port(event_loop, &socket->io_handle); + aws_event_loop_connect_handle_to_io_completion_port(event_loop, &socket->io_handle); socket->event_loop = event_loop; nw_socket->on_connection_result_fn = on_connection_result; @@ -1144,7 +1143,7 @@ static int s_socket_start_accept_fn( return aws_raise_error(AWS_IO_SOCKET_ILLEGAL_OPERATION_FOR_STATE); } - aws_event_loop_connect_handle_to_completion_port(accept_loop, &socket->io_handle); + aws_event_loop_connect_handle_to_io_completion_port(accept_loop, &socket->io_handle); socket->event_loop = accept_loop; socket->accept_result_fn = on_accept_result; socket->connect_accept_user_data = user_data; @@ -1314,7 +1313,7 @@ static int s_socket_assign_to_event_loop_fn(struct aws_socket *socket, struct aw // aws_mutex_lock(&nw_socket->synced_data.lock); nw_socket->synced_data.event_loop = event_loop; - if (!aws_event_loop_connect_handle_to_completion_port(event_loop, &socket->io_handle)) { + if (!aws_event_loop_connect_handle_to_io_completion_port(event_loop, &socket->io_handle)) { nw_connection_start(socket->io_handle.data.handle); aws_mutex_unlock(&nw_socket->synced_data.lock); return AWS_OP_SUCCESS; @@ -1609,4 +1608,3 @@ int aws_socket_get_bound_address(const struct aws_socket *socket, struct aws_soc *out_address = socket->local_endpoint; return AWS_OP_SUCCESS; } -#endif // AWS_USE_DISPATCH_QUEUE diff --git a/source/posix/socket.c b/source/posix/socket.c index 68ca8d7cf..d8a1d7d63 100644 --- a/source/posix/socket.c +++ b/source/posix/socket.c @@ -264,7 +264,6 @@ static int s_socket_init( socket->options = *options; socket->impl = posix_socket; socket->vtable = &s_vtable; - socket->event_loop_style = AWS_EVENT_LOOP_STYLE_POLL_BASED; if (existing_socket_fd < 0) { int err = s_create_socket(socket, options); diff --git a/source/socket.c b/source/socket.c index 4f0730bee..95c247509 100644 --- a/source/socket.c +++ b/source/socket.c @@ -16,7 +16,6 @@ int aws_socket_connect( aws_socket_on_connection_result_fn *on_connection_result, void *user_data) { AWS_PRECONDITION(socket->vtable && socket->vtable->socket_connect_fn); - AWS_PRECONDITION(socket->event_loop_style & event_loop->vtable->event_loop_style); return socket->vtable->socket_connect_fn(socket, remote_endpoint, event_loop, on_connection_result, user_data); } @@ -61,7 +60,6 @@ int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_op int aws_socket_assign_to_event_loop(struct aws_socket *socket, struct aws_event_loop *event_loop) { AWS_PRECONDITION(socket->vtable && socket->vtable->socket_assign_to_event_loop_fn); - AWS_PRECONDITION(socket->event_loop_style & event_loop->vtable->event_loop_style); return socket->vtable->socket_assign_to_event_loop_fn(socket, event_loop); } diff --git a/source/windows/iocp/socket.c b/source/windows/iocp/socket.c index b2b155e6b..925f65f82 100644 --- a/source/windows/iocp/socket.c +++ b/source/windows/iocp/socket.c @@ -433,7 +433,6 @@ static int s_socket_init( socket->state = INIT; socket->impl = impl; socket->options = *options; - socket->event_loop_style = AWS_EVENT_LOOP_STYLE_COMPLETION_PORT_BASED; if (options->domain != AWS_SOCKET_LOCAL && create_underlying_socket) { if (s_create_socket(socket, options)) {