Repository navigation
feat(net): uvcpp_udp_server 支持外部循环(#59) - #60
Merged
Merged
Conversation
Antruly
force-pushed
the
feat/udp-server-external-loop
branch
2 times, most recently
from
October 28, 2026 19:40
551d819 to
31099ea
Compare
与 `uvcpp_tcp_server(uvcpp_loop*)` / `uvcpp_quic_server` 对齐:新增 `explicit uvcpp_udp_server(uvcpp_loop*)`,只认下循环、不拥有它 —— 析构不关不删,`stop_loop()` 在外部模式下是空操作,`stop()` 仍只关本端点的 句柄。用途:在 `uvcpp_web_app` 所在循环上再收一个 UDP 端点(中继数据面), 回调与 WS/TCP/QUIC 连接同循环,避免跨线程。 新增 `tests/functional/udp_server_external_loop_func.cpp`:外部循环用**栈对象** (真被 delete 会当场崩),断言回调在调用方的循环上派发、stop() 之后同一循环上 第二个端点仍能收发、stop_loop() 之后第一轮 NOWAIT 仍派发。变异验证:去掉 `owns_loop_ = false;` 该用例以 "double free or corruption (out)" 崩溃。 被插行撞飞的两处文档引用跟着后移(udp_server.cpp +12),锁文件刷新。
Antruly
force-pushed
the
feat/udp-server-external-loop
branch
from
October 28, 2026 20:13
31099ea to
48b8b60
Compare
Antruly
added a commit
that referenced
this pull request
Oct 28, 2026
PR #60 的分支上为了本地构建在图区里建了 `_local_deps -> /home/zwy/...` 的符号 链接,提交时被 `git add -A` 带了进去(绝对路径,换台机器就是死链)。从索引里 删掉,并把 `_local_deps/` 加进 `.gitignore` —— 它是各机自己准备的依赖源码树, 不是仓库内容。
Antruly
added a commit
that referenced
this pull request
Oct 29, 2026
- 版本头 PATCH 1;两版 README 的徽章与 Version 行同步,"最新版本"改为 v1.9.1。 - CHANGELOG:三条主题条目(WebSocket 语义 / 横向扩展 / TLS 与网络)+ 新增 v1.9.1 小节;当前源码树与 tag 清单同步。 - RELEASE.md:新增「v1.9.1 重点」,破坏性为**无**(只新增 API,C ABI 仍为 1)。 含自 v1.9.0 以来的三笔:#65(h3/h2 WS 帧回调里析构会话后的 UAF)、 #60(`uvcpp_udp_server(uvcpp_loop*)`,#59)、#57(五个 set_ssl_context 入口的 生命周期文档,issue #56),以及 `_local_deps` 误提交链接的清理。 本地:build-all 162/162、build-h3 120/120、build-default 60/60;文档门禁全绿; release_notes.py --tag v1.9.1 能切出正文。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
改了什么
uvcpp_udp_server新增explicit uvcpp_udp_server(uvcpp_loop*),语义与uvcpp_tcp_server(uvcpp_loop*)/uvcpp_quic_server对齐:stop()仍只关本端点的句柄,不停循环;stop_loop()在外部模式下是空操作(头注释写明)。用途:在
uvcpp_web_app所在循环上再收一个 UDP 端点(中继数据面),回调与WS/TCP/QUIC 连接同循环,不用再退回
uvcpp_udp+uvcpp_udp_send手管生命周期。判据
新增
tests/functional/udp_server_external_loop_func.cpp:外部循环用栈对象(若被
delete会当场崩),断言get_loop()返回传进去的指针,回调由调用方run()派发;stop()之后同一条循环上第二个端点仍能收发(循环没被停);stop_loop()之后第一轮UV_RUN_NOWAIT仍派发(多给几轮的话停与不停都绿,判据会空转)。变异验证:去掉构造里的
owns_loop_ = false;,该用例以double free or corruption (out)崩溃。其它
被插行撞飞的两处文档引用(
benchmark.md、net-guide.md→uvcpp_udp_server.cpp)后移 12 行,锁文件刷新;
check_doc_lines/check_docs/ 版本串全绿。本机build-full上udp_server_external_loop_func/udp_server_func/udp_close_token_func全过。