Skip to content

Commit

Permalink
Merge pull request #1384 from stlankes/net
Browse files Browse the repository at this point in the history
remove obsolete usage of poll_on
  • Loading branch information
stlankes authored Sep 14, 2024
2 parents 0ae2c89 + 173f7cb commit 63fce52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
12 changes: 2 additions & 10 deletions src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,7 @@ pub(crate) fn read(fd: FileDescriptor, buf: &mut [u8]) -> io::Result<usize> {
}
})
} else {
match poll_on(obj.async_read(buf), Some(Duration::from_secs(2))) {
Err(io::Error::ETIME) => block_on(obj.async_read(buf), None),
Err(x) => Err(x),
Ok(x) => Ok(x),
}
block_on(obj.async_read(buf), None)
}
}

Expand All @@ -329,11 +325,7 @@ pub(crate) fn write(fd: FileDescriptor, buf: &[u8]) -> io::Result<usize> {
}
})
} else {
match poll_on(obj.async_write(buf), Some(Duration::from_secs(2))) {
Err(io::Error::ETIME) => block_on(obj.async_write(buf), None),
Err(x) => Err(x),
Ok(x) => Ok(x),
}
block_on(obj.async_write(buf), None)
}
}

Expand Down
11 changes: 2 additions & 9 deletions src/fd/socket/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl ObjectInterface for Socket {
Some(Duration::ZERO.into()),
)
} else {
poll_on(self.async_write_with_meta(buf, &meta), None)
block_on(self.async_write_with_meta(buf, &meta), None)
}
} else {
Err(io::Error::EIO)
Expand All @@ -202,14 +202,7 @@ impl ObjectInterface for Socket {
}
})
} else {
match poll_on(
self.async_recvfrom(buf),
Some(Duration::from_secs(2).into()),
) {
Err(io::Error::ETIME) => block_on(self.async_recvfrom(buf), None),
Err(x) => Err(x),
Ok(x) => Ok(x),
}
block_on(self.async_recvfrom(buf), None)
}
}

Expand Down

0 comments on commit 63fce52

Please sign in to comment.