-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: determine driver type at compile time if possible
- Loading branch information
Showing
3 changed files
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,9 @@ impl Socket { | |
// non blocking socket when there is no connections in listen queue | ||
// | ||
// https://patchwork.kernel.org/project/linux-block/patch/[email protected]/#22949861 | ||
if compio_driver::DriverType::is_polling() { | ||
if cfg!(not(all(target_os = "linux", feature = "io-uring"))) | ||
|| compio_driver::DriverType::is_polling() | ||
{ | ||
socket.set_nonblocking(true)?; | ||
} | ||
} | ||
|
@@ -161,7 +163,9 @@ impl Socket { | |
let BufResult(res, op) = compio_runtime::submit(op).await; | ||
let addr = op.into_addr(); | ||
let accept_sock = unsafe { Socket2::from_raw_fd(res? as _) }; | ||
if compio_driver::DriverType::is_polling() { | ||
if cfg!(not(all(target_os = "linux", feature = "io-uring"))) | ||
|| compio_driver::DriverType::is_polling() | ||
{ | ||
accept_sock.set_nonblocking(true)?; | ||
} | ||
let accept_sock = Self::from_socket2(accept_sock)?; | ||
|
This file contains 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