feat(driver)!: accept multi#747
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors how fd-returning operations handle completion/cancellation to prevent descriptor leaks, and adds a multishot accept operation (AcceptMulti) to the driver API.
Changes:
- Replace the previous
set_result-style “store fd inside op” mechanism with an explicitdrop_resulthook andop.result(...)extraction helpers. - Add
Proactor::cancel_ignoreand update runtime/tests/callers to use it so successful-but-ignored results can be disposed (e.g., close fds). - Introduce
AcceptMultiand wire it up across unix/iouring/poll/stub, plus add coverage in driver tests.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| compio/examples/driver.rs | Update example to use op.result(...) for OpenFile instead of into_inner(). |
| compio-runtime/src/runtime/mod.rs | Switch runtime cancellation to cancel_ignore to dispose ignored results. |
| compio-net/src/socket.rs | Update socket creation/accept to use op.result(...) for fd ownership transfer. |
| compio-fs/src/open_options/unix.rs | Update OpenFile completion handling to use op.result(...). |
| compio-driver/tests/personality.rs | Update test helper to use op.result(...) (no IntoInner). |
| compio-driver/tests/op.rs | Refactor multishot wait helper, switch cancellations to cancel_ignore, add accept_multi test. |
| compio-driver/src/sys/unix_op.rs | Remove stored-fd fields; add unsafe result(...) extractors; add AcceptMulti. |
| compio-driver/src/sys/stub/op.rs | Mark AcceptMulti as an OpCode for the stub backend. |
| compio-driver/src/sys/stub/mod.rs | Add a stub drop_result hook to match new driver interface. |
| compio-driver/src/sys/poll/op.rs | Stop storing accepted/created/opened fds in ops; add polling AcceptMulti opcode delegation. |
| compio-driver/src/sys/poll/mod.rs | Add OpCode::drop_result hook and Driver::drop_result dispatcher. |
| compio-driver/src/sys/poll/extra.rs | Remove is_iour() helper from poll Extra. |
| compio-driver/src/sys/iour/op.rs | Rename set_result→drop_result and add AcceptMulti io_uring opcode support. |
| compio-driver/src/sys/iour/mod.rs | Add Driver::drop_result dispatcher; rename trait hook to drop_result. |
| compio-driver/src/sys/iour/extra.rs | Remove is_iour() helper from io_uring Extra. |
| compio-driver/src/sys/iocp/mod.rs | Add no-op drop_result to match new driver interface. |
| compio-driver/src/sys/fusion/op.rs | Macro tweak to support specifying poll/iour op paths. |
| compio-driver/src/sys/fusion/mod.rs | Forward drop_result to the active fused backend driver. |
| compio-driver/src/sys/fusion/extra.rs | Remove is_iour() helper from fusion Extra. |
| compio-driver/src/op.rs | Export AcceptMulti on unix; narrow managed re-exports when not(io_uring). |
| compio-driver/src/lib.rs | Add cancel_with_extra + cancel_ignore; cancellation now can drop ignored results. |
| compio-driver/src/key.rs | Remove io_uring-only set_result special casing that previously stored fds inside ops. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
e66ca09 to
2431cbc
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Have to refactor the
set_resultmechanism to avoid fd leaks.