-
-
Notifications
You must be signed in to change notification settings - Fork 167
feat(net/unix): 为Unix流/seqpacket套接字添加缓冲区大小调整、超时设置与关闭处理 #1555
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
Merged
fslongjin
merged 7 commits into
DragonOS-Community:master
from
fslongjin:feat-unix-stream-seqpacket-buffer-resize-timeout
Dec 26, 2025
Merged
feat(net/unix): 为Unix流/seqpacket套接字添加缓冲区大小调整、超时设置与关闭处理 #1555
fslongjin
merged 7 commits into
DragonOS-Community:master
from
fslongjin:feat-unix-stream-seqpacket-buffer-resize-timeout
Dec 26, 2025
Conversation
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
- 在RingBuffer中新增resize方法,支持动态调整环形缓冲区容量并保持数据一致性 - 为Unix流套接字实现SO_SNDBUF/SO_RCVBUF选项,允许用户设置发送/接收缓冲区大小 - 新增SO_SNDTIMEO/SO_RCVTIMEO超时选项,支持阻塞操作的超时控制 - 重构seqpacket接收逻辑,统一try_recv_seqpacket_meta方法处理peek/truncate场景 - 完善套接字关闭流程,正确通知对端并唤醒等待队列 - 启用gVisor测试中的socket_unix_seqpacket相关测试用例 Signed-off-by: longjin <longjin@DragonOS.org>
- 在Socket trait中新增open_file_counter方法,用于管理socket的打开文件引用计数 - 为UdpSocket、TcpSocket、NetlinkSocket、UnixDatagramSocket和UnixStreamSocket实 现open_file_counter方法 - 修改socket inode的open和close方法,使用引用计数确保只在最后一次关闭时执行清理操作 Signed-off-by: longjin <longjin@DragonOS.org>
- 将RingBuffer::resize()的断言改为返回SystemError错误 - 更新Producer和Consumer的resize方法签名 - 修改Unix流套接字的缓冲区调整方法以处理错误 Signed-off-by: longjin <longjin@DragonOS.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
- 新增连接重置(ECONNRESET)机制,模拟Linux行为 - 实现SO_LINGER、SO_ACCEPTCONN套接字选项支持 - 添加SO_SNDBUF发送缓冲区限制检查 - 修复sendto()在已连接套接字上的EISCONN错误处理 - 优化缓冲区大小计算和限制逻辑 - 通过gVisor socket_unix_stream_test测试 Signed-off-by: longjin <longjin@DragonOS.org>
- 修复环形缓冲区在resize时的并发竞争问题,确保容量计算与索引访问的一致性 - 修复Unix流套接字sendto方法的语义,正确处理连接状态和地址参数 Signed-off-by: longjin <longjin@DragonOS.org>
- 在fcntl(F_SETFL)中增加对socket非阻塞状态的同步,确保内部状态与文件标志一致 - 重构Unix域套接字抽象地址处理,支持二进制名称(可包含嵌入的NUL字符) - 将抽象地址表作用域限定到网络命名空间,修复跨命名空间地址冲突问题 - 修复Unix域套接字地址长度计算,使其符合Linux语义 - 更新gvisor测试白名单,启用socket_unix_unbound_abstract_test测试 Signed-off-by: longjin <longjin@DragonOS.org>
501a668 to
3b731a4
Compare
- 在Listener创建时传入sndbuf_effective和rcvbuf_effective参数 - 新增set_sndbuf_effective和set_rcvbuf_effective方法用于更新监听器缓冲区设置 - 修改push_incoming方法以应用客户端缓冲区配置 - 新增ring_cap_for_effective_sockbuf辅助函数计算环形缓冲区容量 - 在accept时继承监听器端的SO_SNDBUF/SO_RCVBUF设置 - 修改setsockopt逻辑,支持在监听器状态下更新缓冲区大小 Signed-off-by: longjin <longjin@DragonOS.org>
3b731a4 to
05ff09a
Compare
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.
Note
Major UNIX socket improvements and POSIX compliance.
SO_SNDBUF/SO_RCVBUF(with effective sizing) and ring-bufferresize(); addSO_SNDTIMEO/SO_RCVTIMEOtimeouts and storeSO_LINGERSOCK_SEQPACKETreceive path viatry_recv_seqpacket_meta, honoringPEEKandMSG_TRUNC; unify blocking semantics with timeouts and wakeups; refinesendtobehavior for stream/seqpacketO_NONBLOCKfromfcntl(F_SETFL)to socket objects viaSocket::set_nonblockingsockaddr_unhandling: shortaddrlen, binary abstract names, autobind on family-only, and accurate length reporting ingetsockname/getpeernameUnixAbstractTable); makeUnixEndpoint::Abstractbinary (Vec<u8>);bind_in/connect_intakeNetNamespace; binding/lookup keyed by nsiddo_close()runs only on final close using a new open-file refcount inSocketandIndexNode(covers UDP/TCP/Netlink/UNIX)Written by Cursor Bugbot for commit 05ff09a. This will update automatically on new commits. Configure here.