Skip to content

Commit

Permalink
Merge pull request #817 from parallelsystems/raw-socket-nonblock
Browse files Browse the repository at this point in the history
Change `phy::RawSocket` to open the underlying socket with `O_NONBLOCK`
  • Loading branch information
Dirbaio authored Jul 19, 2023
2 parents f9b064a + ab214a6 commit fa7fd3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/phy/sys/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ fn open_device() -> io::Result<libc::c_int> {
unsafe {
for i in 0..256 {
let dev = format!("/dev/bpf{}\0", i);
match libc::open(dev.as_ptr() as *const libc::c_char, libc::O_RDWR) {
match libc::open(
dev.as_ptr() as *const libc::c_char,
libc::O_RDWR | libc::O_NONBLOCK,
) {
-1 => continue,
fd => return Ok(fd),
};
Expand Down

0 comments on commit fa7fd3c

Please sign in to comment.