Skip to content

Commit

Permalink
update compile flags...
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Oct 16, 2024
1 parent f8024d2 commit 0e24c22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions source/darwin/nw_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <arpa/inet.h>
#include <sys/socket.h>

#ifdef AWS_USE_DISPATCH_QUEUE
static int s_determine_socket_error(int error) {
switch (error) {
case ECONNREFUSED:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions source/posix/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0e24c22

Please sign in to comment.