-
Notifications
You must be signed in to change notification settings - Fork 230
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
Support legacy driver #73
Conversation
…mplete iovec support; other optimization
} | ||
_ => unsafe { std::hint::unreachable_unchecked() }, | ||
} | ||
me.index = usize::MAX; |
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.
这是为啥
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.
返回 Ready 意味着这个 index 已经从 Slab 里删除,标记一下。当 Op Drop 时判断一下就不用从 Slab 里捞了(如果捞的话也捞不到因为是 usize::MAX
)。
如果这里不改 index 就不太好标记,下次再捞到的可能是别人的。
|
||
let stream = TcpStream::from_shared_fd(completion.data.fd); | ||
// wait write ready | ||
// TODO: not use write to detect writable | ||
let _ = stream.write([]).await; |
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.
fd EVFILT_WRITE
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.
这个先 TODO 着吧
// But not all platforms have the `accept4(2)` call. Luckily BSD (derived) | ||
// OSes inherit the non-blocking flag from the listener, so we just have to | ||
// set `CLOEXEC`. | ||
#[cfg(any( |
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.
比较复杂的条件编译可以用宏来包装,也不需要增加额外的 block
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.
类似 tokio 的做法
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.
目前还好,就 legacy、linux、iouring 几个 feature 组合的情况。这个后面有需求再另开 PR 搞吧。
(当前这个是从 mio fork 出来的代码,具体 syscall 具体分析,不太好复用)
This PR does many things: