Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,53 @@ jobs:
path: test-results/junit.xml
if-no-files-found: ignore

# Linux with batched datagram I/O turned on. The recvmmsg/sendmmsg paths and
# their reliability-layer wiring are compiled out of every other job, so
# without this they would never even be built. Runs both suites so the
# batched send path is exercised over real loopback traffic.
linux-mmsg:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install OpenSSL
run: sudo apt-get update && sudo apt-get install -y libssl-dev

- name: Configure CMake
# Debug on purpose: this is the only job that compiles the mmsg paths,
# and RakAssert (which is compiled out unless _DEBUG) is what guards the
# invariants they rely on -- the SendBatch count-not-bytes return
# contract, the RNS2SendBatch reentrancy guard, the IPv4-only address
# branch. In Release those checks would not run anywhere.
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DMAFIANET_BUILD_TESTS=ON \
-DMAFIANET_USE_RECVMMSG=ON \
-DMAFIANET_USE_SENDMMSG=ON

- name: Build
run: cmake --build build --parallel 4

- name: Run tests
run: |
ctest --test-dir build \
--output-on-failure \
--repeat until-pass:3 \
--timeout 600 \
--output-junit junit.xml

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-linux-mmsg
path: build/junit.xml
if-no-files-found: ignore

# macOS: Build and run both suites (unit + integration).
macos:
runs-on: macos-latest
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Build directories
build/
Build/
build-*/
out/

# Compiled libraries
Expand Down Expand Up @@ -46,4 +47,7 @@ Makefile

# Package files
*.tar.gz
*.zip
*.zip

# Agent scratch space (plans, specs) -- kept on disk, never committed
docs/superpowers/
16 changes: 16 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# Copyright (c) 2024, MafiaHub
# Licensed under MIT-style license

# Batched datagram I/O (Linux). OFF by default; everything in MmsgBatch.h --
# the helpers and the RNS2SendBatch accumulator alike -- is always compiled and
# unit-tested, but the recvmmsg/sendmmsg syscall paths and their wiring into the
# reliability layer only activate on Linux when these are ON.
option(MAFIANET_USE_RECVMMSG "Batch UDP receives with recvmmsg (Linux only)" OFF)
option(MAFIANET_USE_SENDMMSG "Batch UDP sends with sendmmsg (Linux only)" OFF)

# Source files (explicit list, no GLOB)
set(MAFIANET_SOURCES
src/_FindFirst.cpp
Expand Down Expand Up @@ -47,6 +54,7 @@ set(MAFIANET_SOURCES
src/LocklessTypes.cpp
src/LogCommandParser.cpp
src/MessageFilter.cpp
src/MmsgBatch.cpp
src/NatPunchthroughClient.cpp
src/NatPunchthroughServer.cpp
src/NatTypeDetectionClient.cpp
Expand Down Expand Up @@ -200,6 +208,7 @@ set(MAFIANET_HEADERS
include/mafianet/memoryoverride.h
include/mafianet/MessageFilter.h
include/mafianet/MessageIdentifiers.h
include/mafianet/MmsgBatch.h
include/mafianet/MTUSize.h
include/mafianet/NativeFeatureIncludes.h
include/mafianet/NativeFeatureIncludesOverrides.h
Expand Down Expand Up @@ -337,6 +346,13 @@ function(mafianet_configure_target target_name)
PRIVATE
$<$<CONFIG:Debug>:_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
# PUBLIC so consumers including MmsgBatch.h / socket2.h see the same
# conditional declarations (RNS2SendBatch, the SendBatch override) the
# library was compiled with -- avoids a header/ABI mismatch when a
# downstream build turns batching on.
PUBLIC
$<$<BOOL:${MAFIANET_USE_RECVMMSG}>:MAFIANET_USE_RECVMMSG>
$<$<BOOL:${MAFIANET_USE_SENDMMSG}>:MAFIANET_USE_SENDMMSG>
)

set_target_properties(${target_name} PROPERTIES
Expand Down
Loading
Loading