mirror of https://github.com/smol-rs/polling
Replace log::debug with log::trace
This commit is contained in:
parent
6e4bd15786
commit
bc3dc1ec6e
14
src/epoll.rs
14
src/epoll.rs
|
@ -80,7 +80,7 @@ impl Poller {
|
|||
},
|
||||
)?;
|
||||
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"new: epoll_fd={}, event_fd={}, timer_fd={}",
|
||||
epoll_fd,
|
||||
event_fd,
|
||||
|
@ -91,7 +91,7 @@ impl Poller {
|
|||
|
||||
/// Inserts a file descriptor.
|
||||
pub fn insert(&self, fd: RawFd) -> io::Result<()> {
|
||||
log::debug!("insert: epoll_fd={}, fd={}", self.epoll_fd, fd);
|
||||
log::trace!("insert: epoll_fd={}, fd={}", self.epoll_fd, fd);
|
||||
|
||||
// Put the file descriptor in non-blocking mode.
|
||||
let flags = syscall!(fcntl(fd, libc::F_GETFL))?;
|
||||
|
@ -109,7 +109,7 @@ impl Poller {
|
|||
|
||||
/// Sets interest in a read/write event on a file descriptor and associates a key with it.
|
||||
pub fn interest(&self, fd: RawFd, ev: Event) -> io::Result<()> {
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"interest: epoll_fd={}, fd={}, ev={:?}",
|
||||
self.epoll_fd,
|
||||
fd,
|
||||
|
@ -135,7 +135,7 @@ impl Poller {
|
|||
|
||||
/// Removes a file descriptor.
|
||||
pub fn remove(&self, fd: RawFd) -> io::Result<()> {
|
||||
log::debug!("remove: epoll_fd={}, fd={}", self.epoll_fd, fd);
|
||||
log::trace!("remove: epoll_fd={}, fd={}", self.epoll_fd, fd);
|
||||
|
||||
syscall!(epoll_ctl(
|
||||
self.epoll_fd,
|
||||
|
@ -148,7 +148,7 @@ impl Poller {
|
|||
|
||||
/// Waits for I/O events with an optional timeout.
|
||||
pub fn wait(&self, events: &mut Events, timeout: Option<Duration>) -> io::Result<()> {
|
||||
log::debug!("wait: epoll_fd={}, timeout={:?}", self.epoll_fd, timeout);
|
||||
log::trace!("wait: epoll_fd={}, timeout={:?}", self.epoll_fd, timeout);
|
||||
|
||||
// Configure the timeout using timerfd.
|
||||
let new_val = libc::itimerspec {
|
||||
|
@ -213,7 +213,7 @@ impl Poller {
|
|||
|
||||
/// Sends a notification to wake up the current or next `wait()` call.
|
||||
pub fn notify(&self) -> io::Result<()> {
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"notify: epoll_fd={}, event_fd={}",
|
||||
self.epoll_fd,
|
||||
self.event_fd
|
||||
|
@ -231,7 +231,7 @@ impl Poller {
|
|||
|
||||
impl Drop for Poller {
|
||||
fn drop(&mut self) {
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"drop: epoll_fd={}, event_fd={}, timer_fd={}",
|
||||
self.epoll_fd,
|
||||
self.event_fd,
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Poller {
|
|||
},
|
||||
)?;
|
||||
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"new: kqueue_fd={}, read_stream={:?}",
|
||||
kqueue_fd,
|
||||
poller.read_stream
|
||||
|
@ -55,7 +55,7 @@ impl Poller {
|
|||
/// Inserts a file descriptor.
|
||||
pub fn insert(&self, fd: RawFd) -> io::Result<()> {
|
||||
if fd != self.read_stream.as_raw_fd() {
|
||||
log::debug!("insert: fd={}", fd);
|
||||
log::trace!("insert: fd={}", fd);
|
||||
}
|
||||
|
||||
// Put the file descriptor in non-blocking mode.
|
||||
|
@ -67,7 +67,7 @@ impl Poller {
|
|||
/// Sets interest in a read/write event on a file descriptor and associates a key with it.
|
||||
pub fn interest(&self, fd: RawFd, ev: Event) -> io::Result<()> {
|
||||
if fd != self.read_stream.as_raw_fd() {
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"interest: kqueue_fd={}, fd={}, ev={:?}",
|
||||
self.kqueue_fd,
|
||||
fd,
|
||||
|
@ -137,7 +137,7 @@ impl Poller {
|
|||
/// Removes a file descriptor.
|
||||
pub fn remove(&self, fd: RawFd) -> io::Result<()> {
|
||||
if fd != self.read_stream.as_raw_fd() {
|
||||
log::debug!("remove: kqueue_fd={}, fd={}", self.kqueue_fd, fd);
|
||||
log::trace!("remove: kqueue_fd={}, fd={}", self.kqueue_fd, fd);
|
||||
}
|
||||
|
||||
// A list of changes for kqueue.
|
||||
|
@ -183,7 +183,7 @@ impl Poller {
|
|||
|
||||
/// Waits for I/O events with an optional timeout.
|
||||
pub fn wait(&self, events: &mut Events, timeout: Option<Duration>) -> io::Result<()> {
|
||||
log::debug!("wait: kqueue_fd={}, timeout={:?}", self.kqueue_fd, timeout);
|
||||
log::trace!("wait: kqueue_fd={}, timeout={:?}", self.kqueue_fd, timeout);
|
||||
|
||||
// Convert the `Duration` to `libc::timespec`.
|
||||
let timeout = timeout.map(|t| libc::timespec {
|
||||
|
@ -224,7 +224,7 @@ impl Poller {
|
|||
|
||||
/// Sends a notification to wake up the current or next `wait()` call.
|
||||
pub fn notify(&self) -> io::Result<()> {
|
||||
log::debug!("notify: kqueue_fd={}", self.kqueue_fd);
|
||||
log::trace!("notify: kqueue_fd={}", self.kqueue_fd);
|
||||
let _ = (&self.write_stream).write(&[1]);
|
||||
Ok(())
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ impl Poller {
|
|||
|
||||
impl Drop for Poller {
|
||||
fn drop(&mut self) {
|
||||
log::debug!("drop: kqueue_fd={}", self.kqueue_fd);
|
||||
log::trace!("drop: kqueue_fd={}", self.kqueue_fd);
|
||||
let _ = self.remove(self.read_stream.as_raw_fd());
|
||||
let _ = syscall!(close(self.kqueue_fd));
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ impl Poller {
|
|||
/// # std::io::Result::Ok(())
|
||||
/// ```
|
||||
pub fn wait(&self, events: &mut Vec<Event>, timeout: Option<Duration>) -> io::Result<usize> {
|
||||
log::debug!("Poller::wait(_, {:?})", timeout);
|
||||
log::trace!("Poller::wait(_, {:?})", timeout);
|
||||
|
||||
if let Ok(mut lock) = self.events.try_lock() {
|
||||
// Wait for I/O events.
|
||||
|
@ -386,7 +386,7 @@ impl Poller {
|
|||
/// # std::io::Result::Ok(())
|
||||
/// ```
|
||||
pub fn notify(&self) -> io::Result<()> {
|
||||
log::debug!("Poller::notify()");
|
||||
log::trace!("Poller::notify()");
|
||||
if !self
|
||||
.notified
|
||||
.compare_and_swap(false, true, Ordering::SeqCst)
|
||||
|
|
|
@ -42,13 +42,13 @@ impl Poller {
|
|||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
let notified = AtomicBool::new(false);
|
||||
log::debug!("new: handle={:?}", handle);
|
||||
log::trace!("new: handle={:?}", handle);
|
||||
Ok(Poller { handle, notified })
|
||||
}
|
||||
|
||||
/// Inserts a socket.
|
||||
pub fn insert(&self, sock: RawSocket) -> io::Result<()> {
|
||||
log::debug!("insert: handle={:?}, sock={}", self.handle, sock);
|
||||
log::trace!("insert: handle={:?}, sock={}", self.handle, sock);
|
||||
|
||||
// Put the socket in non-blocking mode.
|
||||
unsafe {
|
||||
|
@ -82,7 +82,7 @@ impl Poller {
|
|||
|
||||
/// Sets interest in a read/write event on a socket and associates a key with it.
|
||||
pub fn interest(&self, sock: RawSocket, ev: Event) -> io::Result<()> {
|
||||
log::debug!(
|
||||
log::trace!(
|
||||
"interest: handle={:?}, sock={}, ev={:?}",
|
||||
self.handle,
|
||||
sock,
|
||||
|
@ -113,7 +113,7 @@ impl Poller {
|
|||
|
||||
/// Removes a socket.
|
||||
pub fn remove(&self, sock: RawSocket) -> io::Result<()> {
|
||||
log::debug!("remove: handle={:?}, sock={}", self.handle, sock);
|
||||
log::trace!("remove: handle={:?}, sock={}", self.handle, sock);
|
||||
wepoll!(epoll_ctl(
|
||||
self.handle,
|
||||
we::EPOLL_CTL_DEL as libc::c_int,
|
||||
|
@ -130,7 +130,7 @@ impl Poller {
|
|||
/// If a notification occurs, this method will return but the notification event will not be
|
||||
/// included in the `events` list nor contribute to the returned count.
|
||||
pub fn wait(&self, events: &mut Events, timeout: Option<Duration>) -> io::Result<()> {
|
||||
log::debug!("wait: handle={:?}, timeout={:?}", self.handle, timeout);
|
||||
log::trace!("wait: handle={:?}, timeout={:?}", self.handle, timeout);
|
||||
let deadline = timeout.map(|t| Instant::now() + t);
|
||||
|
||||
loop {
|
||||
|
@ -167,7 +167,7 @@ impl Poller {
|
|||
|
||||
/// Sends a notification to wake up the current or next `wait()` call.
|
||||
pub fn notify(&self) -> io::Result<()> {
|
||||
log::debug!("notify: handle={:?}", self.handle);
|
||||
log::trace!("notify: handle={:?}", self.handle);
|
||||
|
||||
if !self
|
||||
.notified
|
||||
|
@ -193,7 +193,7 @@ impl Poller {
|
|||
|
||||
impl Drop for Poller {
|
||||
fn drop(&mut self) {
|
||||
log::debug!("drop: handle={:?}", self.handle);
|
||||
log::trace!("drop: handle={:?}", self.handle);
|
||||
unsafe {
|
||||
we::epoll_close(self.handle);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue