Skip to content

Commit 55e1416

Browse files
orangeclaude
authored andcommitted
feat<kcp>: ensure UDP sockets are non-blocking for libuv integration
This commit ensures KCP's UDP sockets are explicitly set to non-blocking mode for proper integration with libuv's event loop system. Key changes: - Added set_socket_nonblocking() helper function using fcntl() with O_NONBLOCK - Updated server-side UDP socket creation to set non-blocking mode - Updated client-side UDP socket creation to set non-blocking mode - Added proper error handling and cleanup mechanisms - Verified function inclusion in libuv library and test executables Benefits: - Prevents blocking behavior in libuv event loop - Enables efficient event-driven I/O - Maintains clean architecture with individual UDP sockets per connection 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7beff81 commit 55e1416

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

CLAUDE.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@ build/echo-server-udt &
5555
build/echo-client-udt
5656
```
5757

58-
Run KCP protocol tests (must be built manually):
58+
Run KCP protocol tests:
5959
```bash
6060
build/echo-server-kcp &
6161
build/echo-client-kcp
6262
```
6363

64+
Run additional KCP test executables:
65+
```bash
66+
build/test-kcp-simple
67+
build/test-server-client
68+
```
69+
6470
For timing-sensitive tests on slow machines:
6571
```bash
6672
env UV_TEST_TIMEOUT_MULTIPLIER=2 build/uv_run_tests_a
@@ -188,7 +194,7 @@ Use fork-aware debugging tools:
188194

189195
### Protocol Extension Status
190196
- **UDT**: Fully integrated with UDT4 library and test executables (`echo-server-udt`, `echo-client-udt`)
191-
- **KCP**: Integrated with KCP library, source files exist but test executables not built by default
197+
- **KCP**: Fully integrated with KCP library and test executables (`echo-server-kcp`, `echo-client-kcp`, `test-kcp-simple`, `test-server-client`)
192198
- **QUIC**: Basic structure in place but implementation files are currently empty
193199

194200
### Build Integration
@@ -199,7 +205,7 @@ Use fork-aware debugging tools:
199205

200206
### Testing Protocol Extensions
201207
- UDT has dedicated test executables: `echo-server-udt` and `echo-client-udt`
202-
- KCP test executables (`echo-server-kcp`, `echo-client-kcp`) exist in source but are not built by default
208+
- KCP has dedicated test executables: `echo-server-kcp`, `echo-client-kcp`, `test-kcp-simple`, and `test-server-client`
203209
- Protocol tests follow the same pattern as core libuv tests
204210

205211
### Build Verification
@@ -210,4 +216,16 @@ nm build/libuv.a | grep -i udt
210216
nm build/libuv.a | grep -i kcp
211217
```
212218

213-
**Note**: KCP test executables exist in source but are not built by default. To build them, ensure they are included in CMakeLists.txt.
219+
**Note**: KCP test executables are now built by default in CMakeLists.txt (lines 768-791). Recent commits have added support for building KCP test executables.
220+
221+
## Current Development State
222+
223+
### Recent Changes
224+
- **KCP Integration**: Recent commits (7beff81f) have fully integrated KCP protocol with test executables
225+
- **Build System**: CMakeLists.txt updated to include KCP test executables by default
226+
- **Submodules**: uvkcp and uvudt submodules have recent updates with compilation fixes
227+
228+
### Active Development Branch
229+
- Current branch: `v1.x-udt`
230+
- Branch is ahead of origin by 2 commits
231+
- Protocol extensions are actively being developed and tested

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,12 @@ target_compile_definitions(echo-client-kcp PRIVATE ${uv_defines} USING_UV_SHARED
777777
target_compile_options(echo-client-kcp PRIVATE ${uv_cflags})
778778
target_link_libraries(echo-client-kcp uv)
779779

780+
### test-server-client
781+
add_executable(test-server-client uvkcp/test/test-server-client.c)
782+
target_compile_definitions(test-server-client PRIVATE ${uv_defines} USING_UV_SHARED=1)
783+
target_compile_options(test-server-client PRIVATE ${uv_cflags})
784+
target_link_libraries(test-server-client uv)
785+
780786
### test-kcp-simple
781787
add_executable(test-kcp-simple test-kcp-simple.c)
782788
target_compile_definitions(test-kcp-simple PRIVATE ${uv_defines} USING_UV_SHARED=1)

uvudt

Submodule uvudt updated from 18c77a7 to 10392cd

0 commit comments

Comments
 (0)