diff --git a/include/aws/io/socket.h b/include/aws/io/socket.h index 149d613a0..3506f7f1b 100644 --- a/include/aws/io/socket.h +++ b/include/aws/io/socket.h @@ -37,9 +37,9 @@ enum aws_socket_type { * * PLATFORM DEFAULT SOCKET IMPLEMENTATION TYPE * Linux | AWS_SOCKET_IMPL_POSIX - * Windows | AWS_SOCKET_IMPL_WINSOCK + * Windows | AWS_SOCKET_IMPL_WINSOCK * BSD Variants| AWS_SOCKET_IMPL_POSIX - * MacOS | AWS_SOCKET_IMPL_POSIX + * MacOS | AWS_SOCKET_IMPL_POSIX * iOS | AWS_SOCKET_IMPL_APPLE_NETWORK_FRAMEWORK */ enum aws_socket_impl_type { diff --git a/source/windows/iocp/iocp_event_loop.c b/source/windows/iocp/iocp_event_loop.c index 584ba0b1c..ff390670f 100644 --- a/source/windows/iocp/iocp_event_loop.c +++ b/source/windows/iocp/iocp_event_loop.c @@ -144,7 +144,7 @@ struct aws_event_loop_vtable s_iocp_vtable = { .free_io_event_resources = s_free_io_event_resources, }; -struct aws_event_loop *aws_event_loop_new_with_iocp_with_options( +struct aws_event_loop *aws_event_loop_new_with_iocp( struct aws_allocator *alloc, const struct aws_event_loop_options *options) { AWS_ASSERT(alloc); diff --git a/tests/event_loop_test.c b/tests/event_loop_test.c index 0685eea8d..791f3d8c1 100644 --- a/tests/event_loop_test.c +++ b/tests/event_loop_test.c @@ -874,59 +874,6 @@ static int s_state_wait_1sec(struct thread_tester *tester) { } } -/* Verify default event loop type */ -static int s_test_event_loop_creation( - struct aws_allocator *allocator, - enum aws_event_loop_type type, - bool expect_success) { - struct aws_event_loop_options event_loop_options = { - .thread_options = NULL, - .clock = aws_high_res_clock_get_ticks, - .type = type, - }; - - struct aws_event_loop *event_loop = aws_event_loop_new(allocator, &event_loop_options); - - if (expect_success) { - ASSERT_NOT_NULL(event_loop); - /* Clean up tester*/ - aws_event_loop_destroy(event_loop); - } else { - ASSERT_NULL(event_loop); - } - - return AWS_OP_SUCCESS; -} - -/* Verify default event loop type */ -static int s_test_event_loop_all_types_creation(struct aws_allocator *allocator, void *ctx) { - (void)ctx; - bool enable_kqueue = false; - bool enable_epoll = false; - bool enable_iocp = false; - bool enable_dispatch_queue = false; -# ifdef AWS_ENABLE_KQUEUE - enable_kqueue = true; -# endif -# ifdef AWS_ENABLE_EPOLL - enable_epoll = true; -# endif -# ifdef AWS_ENABLE_IO_COMPLETION_PORTS - enable_iocp = true; -# endif -# ifdef AWS_ENABLE_DISPATCH_QUEUE -// TODO: Dispatch queue support is not yet implemented. Uncomment the following line once the dispatch queue is ready. -// enable_dispatch_queue = true; -# endif - - return s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_EPOLL, enable_epoll) || - s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_IOCP, enable_iocp) || - s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_KQUEUE, enable_kqueue) || - s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_DISPATCH_QUEUE, enable_dispatch_queue); -} - -AWS_TEST_CASE(event_loop_all_types_creation, s_test_event_loop_all_types_creation) - /* Test that subscribe/unubscribe work at all */ static int s_test_event_loop_subscribe_unsubscribe(struct aws_allocator *allocator, void *ctx) { (void)ctx; @@ -1038,6 +985,59 @@ AWS_TEST_CASE(event_loop_readable_event_on_2nd_time_readable, s_test_event_loop_ #endif /* AWS_ENABLE_IO_COMPLETION_PORTS */ +/* Verify default event loop type */ +static int s_test_event_loop_creation( + struct aws_allocator *allocator, + enum aws_event_loop_type type, + bool expect_success) { + struct aws_event_loop_options event_loop_options = { + .thread_options = NULL, + .clock = aws_high_res_clock_get_ticks, + .type = type, + }; + + struct aws_event_loop *event_loop = aws_event_loop_new(allocator, &event_loop_options); + + if (expect_success) { + ASSERT_NOT_NULL(event_loop); + /* Clean up tester*/ + aws_event_loop_destroy(event_loop); + } else { + ASSERT_NULL(event_loop); + } + + return AWS_OP_SUCCESS; +} + +/* Verify default event loop type */ +static int s_test_event_loop_all_types_creation(struct aws_allocator *allocator, void *ctx) { + (void)ctx; + bool enable_kqueue = false; + bool enable_epoll = false; + bool enable_iocp = false; + bool enable_dispatch_queue = false; +#ifdef AWS_ENABLE_KQUEUE + enable_kqueue = true; +#endif +#ifdef AWS_ENABLE_EPOLL + enable_epoll = true; +#endif +#ifdef AWS_ENABLE_IO_COMPLETION_PORTS + enable_iocp = true; +#endif +#ifdef AWS_ENABLE_DISPATCH_QUEUE +// TODO: Dispatch queue support is not yet implemented. Uncomment the following line once the dispatch queue is ready. +// enable_dispatch_queue = true; +#endif + + return s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_EPOLL, enable_epoll) || + s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_IOCP, enable_iocp) || + s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_KQUEUE, enable_kqueue) || + s_test_event_loop_creation(allocator, AWS_EVENT_LOOP_DISPATCH_QUEUE, enable_dispatch_queue); +} + +AWS_TEST_CASE(event_loop_all_types_creation, s_test_event_loop_all_types_creation) + static int s_event_loop_test_stop_then_restart(struct aws_allocator *allocator, void *ctx) { (void)ctx; struct aws_event_loop *event_loop = aws_event_loop_new_default(allocator, aws_high_res_clock_get_ticks); diff --git a/tests/socket_test.c b/tests/socket_test.c index 4d35efa55..f96b20e4f 100644 --- a/tests/socket_test.c +++ b/tests/socket_test.c @@ -413,6 +413,7 @@ static int s_test_socket_creation(struct aws_allocator *alloc, enum aws_socket_i } static int s_test_socket_impl_types_creation(struct aws_allocator *allocator, void *ctx) { + (void)ctx; int posix_expected_result = AWS_ERROR_PLATFORM_NOT_SUPPORTED; int winsock_expected_result = AWS_ERROR_PLATFORM_NOT_SUPPORTED; #if defined(AWS_ENABLE_KQUEUE) || defined(AWS_ENABLE_EPOLL)