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

Event Loop & Socket Type Multi-Support #692

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
9d97302
Checkpoint
bretambrose Oct 30, 2024
9781845
Updated with doc comments
Oct 31, 2024
754c56d
Creation API
Oct 31, 2024
974a9b2
Checkpoint
Nov 5, 2024
0b7b061
Merge branch 'main' into EventLoopPublicApi
Nov 5, 2024
75e4f45
Formatting
Nov 5, 2024
4a784cc
Oops
Nov 5, 2024
381f3dd
Windows updates
Nov 5, 2024
e63c0a8
test update
Nov 5, 2024
09cff00
[WIP] API update for runtime switch event loop
xiazhvera Nov 7, 2024
ca3a134
update event loop group creation
xiazhvera Nov 7, 2024
6619695
clang format
xiazhvera Nov 7, 2024
7a89d9e
revert shutdown_types?
xiazhvera Nov 7, 2024
56fa4d1
rename cmake flags
xiazhvera Nov 7, 2024
c1a4971
fix default event loop
xiazhvera Nov 7, 2024
470164b
improve error message
xiazhvera Nov 7, 2024
9e6d574
Update based on PR feedback:
Nov 7, 2024
d8f5fdd
Merge branch 'EventLoopPublicApi' of github.com:awslabs/aws-c-io into…
xiazhvera Nov 7, 2024
9323cc3
Make io testing channel usable across library boundaries
Nov 7, 2024
b771d8c
Revert "Make io testing channel usable across library boundaries"
Nov 7, 2024
4f3048e
add function to override the default event loop type
xiazhvera Nov 7, 2024
fcb3d9a
Revert "Revert "Make io testing channel usable across library boundar…
Nov 8, 2024
9b16a3b
Set allocator
Nov 8, 2024
a30cd39
default event loop type override
xiazhvera Nov 8, 2024
74733ad
hide the test help function as internal private
xiazhvera Nov 8, 2024
558d179
clang format
xiazhvera Nov 8, 2024
16d4e25
remove unreachable..
xiazhvera Nov 8, 2024
7cb0936
update cmake for dispatch queue
xiazhvera Nov 8, 2024
e84a1a6
introduce socket vtable
xiazhvera Nov 8, 2024
d79b5b7
fix platform error code
xiazhvera Nov 8, 2024
3ce216c
remove global vtable
xiazhvera Nov 9, 2024
6233c9d
fix flag
xiazhvera Nov 9, 2024
0f75185
set apple networkframework flag
xiazhvera Nov 9, 2024
f7fb5a2
prevent fail fast
xiazhvera Nov 9, 2024
16861b9
update cmake event loop defines
xiazhvera Nov 9, 2024
17c7cca
temporary remove dispatch queue wrap
xiazhvera Nov 9, 2024
d68acdb
Doc comments
bretambrose Nov 11, 2024
3999196
make apple network framework public
xiazhvera Nov 11, 2024
6f1984c
Merge branch 'EventLoopPublicApi' of github.com:awslabs/aws-c-io into…
xiazhvera Nov 11, 2024
8d84d11
Apply suggestions from code review
xiazhvera Nov 11, 2024
71fae6f
update cr changes
xiazhvera Nov 11, 2024
35efc2e
Merge branch 'runtime_select_event_loop' of github.com:awslabs/aws-c-…
xiazhvera Nov 11, 2024
405c988
rename enum
xiazhvera Nov 12, 2024
e614bdc
Merge branch 'main' of github.com:awslabs/aws-c-io into runtime_selec…
xiazhvera Nov 12, 2024
e22131a
Merge branch 'main' into runtime_select_event_loop
xiazhvera Nov 12, 2024
51e2d5a
eliminate event loop constructor
xiazhvera Nov 12, 2024
8be6cd2
clean up and format
xiazhvera Nov 12, 2024
ab05a35
Merge branch 'main' into runtime_select_event_loop
xiazhvera Nov 12, 2024
61cbc90
lint
xiazhvera Nov 12, 2024
4d0e12c
Merge branch 'runtime_select_event_loop' of github.com:awslabs/aws-c-…
xiazhvera Nov 12, 2024
7b51b56
wrap the kqueue function
xiazhvera Nov 12, 2024
aa876a1
add posix file for non-darwin Apple platform
xiazhvera Nov 12, 2024
ee7fa76
fix lint
xiazhvera Nov 12, 2024
2fb32ab
handling library error in cmake
xiazhvera Nov 12, 2024
f5a5338
Merge branch 'main' into runtime_select_event_loop
xiazhvera Nov 13, 2024
7ea8588
renmae event loop new function
xiazhvera Nov 13, 2024
1cbe989
update code review comments
xiazhvera Nov 21, 2024
667e41a
add unit test
xiazhvera Nov 22, 2024
48ad48c
move to private socket header
xiazhvera Nov 22, 2024
17b79a4
move function definition
xiazhvera Nov 22, 2024
a32ee15
include private header & rename function
xiazhvera Nov 22, 2024
c53b4ad
include private socket header
xiazhvera Nov 22, 2024
ad5152c
format
xiazhvera Nov 22, 2024
1afb859
move windows related header to private
xiazhvera Nov 25, 2024
182757f
fix unreferenced param
xiazhvera Nov 25, 2024
02afc29
rename windows creation
xiazhvera Nov 25, 2024
6610f79
format
xiazhvera Nov 25, 2024
53fc1fc
add event loop creation test for windows
xiazhvera Nov 25, 2024
6fcd019
Merge branch 'main' into runtime_select_event_loop
xiazhvera Dec 3, 2024
31a9a95
update cr
xiazhvera Dec 4, 2024
e1d7513
remove apple network framewokr CI so that we dont block merge
xiazhvera Dec 9, 2024
98c558e
update vcc and related hash
xiazhvera Dec 17, 2024
c8e57c5
update checksum
xiazhvera Dec 17, 2024
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
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,16 @@ jobs:

macos:
runs-on: macos-14 # latest
strategy:
fail-fast: false
matrix:
eventloop: ["-DAWS_USE_APPLE_NETWORK_FRAMEWORK=ON", "-DAWS_USE_APPLE_NETWORK_FRAMEWORK=OFF"]
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
./builder build -p ${{ env.PACKAGE_NAME }} --cmake-extra=${{ matrix.eventloop }}

macos-x64:
runs-on: macos-14-large # latest
Expand All @@ -176,12 +180,16 @@ jobs:

macos-debug:
runs-on: macos-14 # latest
strategy:
fail-fast: false
matrix:
eventloop: ["-DAWS_USE_APPLE_NETWORK_FRAMEWORK=ON", "-DAWS_USE_APPLE_NETWORK_FRAMEWORK=OFF"]
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }} --config Debug
./builder build -p ${{ env.PACKAGE_NAME }} --cmake-extra=${{ matrix.eventloop }} --config Debug

freebsd:
runs-on: ubuntu-22.04 # latest
Expand Down Expand Up @@ -219,4 +227,4 @@ jobs:
sudo pkg_add py3-urllib3
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
./builder build -p ${{ env.PACKAGE_NAME }}
35 changes: 27 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if (WIN32)
)
list(APPEND AWS_IO_OS_SRC ${AWS_IO_IOCP_SRC})

set(EVENT_LOOP_DEFINE "IO_COMPLETION_PORTS")
list(APPEND EVENT_LOOP_DEFINES "IO_COMPLETION_PORTS")
endif ()

if (MSVC)
Expand All @@ -102,7 +102,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Androi
)
set(PLATFORM_LIBS "")

set(EVENT_LOOP_DEFINE "EPOLL")
list(APPEND EVENT_LOOP_DEFINES "EPOLL")
set(USE_S2N ON)

elseif (APPLE)
Expand All @@ -111,8 +111,6 @@ elseif (APPLE)
)

file(GLOB AWS_IO_OS_SRC
"source/bsd/*.c"
"source/posix/*.c"
xiazhvera marked this conversation as resolved.
Show resolved Hide resolved
"source/darwin/*.c"
)

Expand All @@ -121,9 +119,24 @@ elseif (APPLE)
message(FATAL_ERROR "Security framework not found")
endif ()

find_library(NETWORK_LIB Network)
if (NOT NETWORK_LIB)
message(FATAL_ERROR "Network framework not found")
endif ()

#No choice on TLS for apple, darwinssl will always be used.
xiazhvera marked this conversation as resolved.
Show resolved Hide resolved
list(APPEND PLATFORM_LIBS "-framework Security")
set(EVENT_LOOP_DEFINE "KQUEUE")
list(APPEND PLATFORM_LIBS "-framework Security -framework Network")
list(APPEND EVENT_LOOP_DEFINES "DISPATCH_QUEUE")

# Enable KQUEUE on MacOS
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB AWS_IO_KUEUE_SRC
"source/bsd/*.c"
"source/posix/*.c"
)
list(APPEND AWS_IO_OS_SRC ${AWS_IO_KUEUE_SRC})
list(APPEND EVENT_LOOP_DEFINES "KQUEUE")
endif()

elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
file(GLOB AWS_IO_OS_HEADERS
Expand All @@ -134,7 +147,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetB
"source/posix/*.c"
)

set(EVENT_LOOP_DEFINE "KQUEUE")
list(APPEND EVENT_LOOP_DEFINES "KQUEUE")
set(USE_S2N ON)

endif()
Expand Down Expand Up @@ -187,7 +200,9 @@ aws_add_sanitizers(${PROJECT_NAME})
# We are not ABI stable yet
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0)

target_compile_definitions(${PROJECT_NAME} PUBLIC "-DAWS_USE_${EVENT_LOOP_DEFINE}")
foreach(EVENT_LOOP_DEFINE IN LISTS EVENT_LOOP_DEFINES)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DAWS_ENABLE_${EVENT_LOOP_DEFINE}")
endforeach()

if (BYO_CRYPTO)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DBYO_CRYPTO")
Expand All @@ -205,6 +220,10 @@ if (USE_VSOCK)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DUSE_VSOCK")
endif()

if (AWS_USE_APPLE_NETWORK_FRAMEWORK)
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DAWS_USE_APPLE_NETWORK_FRAMEWORK")
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Expand Down
Loading
Loading