diff --git a/CMakeLists.txt b/CMakeLists.txt index b9e25fadd..0c4b5e441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,8 +116,7 @@ elseif (APPLE) file(GLOB AWS_IO_OS_SRC "source/bsd/*.c" "source/posix/*.c" - "source/darwin/darwin_pki_utils.c" - "source/darwin/secure_transport_tls_channel_handler.c" + "source/darwin/*.c" ) find_library(SECURITY_LIB Security) @@ -136,11 +135,6 @@ elseif (APPLE) if(AWS_USE_DISPATCH_QUEUE OR IOS) set(EVENT_LOOP_DEFINES "-DAWS_USE_DISPATCH_QUEUE" ) message("use dispatch queue") - file(GLOB AWS_IO_DISPATCH_QUEUE_SRC - "source/darwin/dispatch_queue_event_loop.c" - "source/darwin/nw_socket.c" - ) - list(APPEND AWS_IO_OS_SRC ${AWS_IO_DISPATCH_QUEUE_SRC}) else () set(EVENT_LOOP_DEFINES "-DAWS_USE_KQUEUE") endif() diff --git a/source/darwin/nw_socket.c b/source/darwin/nw_socket.c index 99e3b5711..b7ff82556 100644 --- a/source/darwin/nw_socket.c +++ b/source/darwin/nw_socket.c @@ -17,6 +17,7 @@ #include #include +#ifdef AWS_USE_DISPATCH_QUEUE static int s_determine_socket_error(int error) { switch (error) { case ECONNREFUSED: @@ -54,6 +55,7 @@ static int s_determine_socket_error(int error) { } } + static inline int s_convert_pton_error(int pton_code) { if (pton_code == 0) { return AWS_IO_SOCKET_INVALID_ADDRESS; @@ -322,7 +324,6 @@ static void s_socket_impl_destroy(void *sock_ptr) { nw_socket = NULL; } -#ifdef AWS_USE_DISPATCH_QUEUE int aws_socket_init(struct aws_socket *socket, struct aws_allocator *alloc, const struct aws_socket_options *options) { AWS_ASSERT(options); AWS_ZERO_STRUCT(*socket); @@ -371,7 +372,6 @@ int aws_socket_init(struct aws_socket *socket, struct aws_allocator *alloc, cons return AWS_OP_SUCCESS; } -#endif // AWS_USE_DISPATCH_QUEUE static void s_client_set_dispatch_queue(struct aws_io_handle *handle, void *queue) { nw_connection_set_queue(handle->data.handle, queue); @@ -1589,7 +1589,6 @@ static bool s_socket_is_open_fn(struct aws_socket *socket) { return nw_socket->last_error == AWS_OP_SUCCESS; } -#ifdef AWS_USE_DISPATCH_QUEUE void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint *endpoint) { struct aws_uuid uuid; AWS_FATAL_ASSERT(aws_uuid_init(&uuid) == AWS_OP_SUCCESS); diff --git a/source/posix/socket.c b/source/posix/socket.c index 61c2849c0..8b7ff3842 100644 --- a/source/posix/socket.c +++ b/source/posix/socket.c @@ -292,7 +292,7 @@ static int s_socket_init( return AWS_OP_SUCCESS; } -#ifdef AWS_USE_KQUEUE || AWS_USE_EPOLL +#if defined(AWS_USE_KQUEUE) || defined(AWS_USE_EPOLL) int aws_socket_init(struct aws_socket *socket, struct aws_allocator *alloc, const struct aws_socket_options *options) { AWS_ASSERT(options); return s_socket_init(socket, alloc, options, -1); @@ -949,7 +949,7 @@ static int s_socket_bind(struct aws_socket *socket, const struct aws_socket_endp return AWS_OP_ERR; } -#ifdef AWS_USE_KQUEUE || AWS_USE_EPOLL +#if defined(AWS_USE_KQUEUE) || defined(AWS_USE_EPOLL) int aws_socket_get_bound_address(const struct aws_socket *socket, struct aws_socket_endpoint *out_address) { if (socket->local_endpoint.address[0] == 0) { AWS_LOGF_ERROR( @@ -2054,7 +2054,7 @@ static bool s_socket_is_open(struct aws_socket *socket) { return socket->io_handle.data.fd >= 0; } -#ifdef AWS_USE_KQUEUE || AWS_USE_EPOLL +#if defined(AWS_USE_KQUEUE) || defined(AWS_USE_EPOLL) void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint *endpoint) { struct aws_uuid uuid; AWS_FATAL_ASSERT(aws_uuid_init(&uuid) == AWS_OP_SUCCESS);