MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / handle_timeout

Method handle_timeout

virtio-devices/src/console.rs:495–512  ·  view source on GitHub ↗

This function will be invoked whenever the timeout is reached before any other event was triggered while waiting for the epoll.

(&mut self, helper: &mut EpollHelper)

Source from the content-addressed store, hash-verified

493 // This function will be invoked whenever the timeout is reached before
494 // any other event was triggered while waiting for the epoll.
495 fn handle_timeout(&mut self, helper: &mut EpollHelper) -> Result<(), EpollHelperError> {
496 if !self.endpoint.is_pty() {
497 return Ok(());
498 }
499
500 if self.file_event_registered {
501 // This very specific case happens when the console is connected
502 // to a PTY. We know EPOLLHUP is always present when there's nothing
503 // connected at the other end of the PTY. That's why getting no event
504 // means we can flush the output of the console through the PTY.
505 self.trigger_pty_flush()
506 .map_err(EpollHelperError::HandleTimeout)?;
507 }
508
509 // Every time we hit the timeout, let's register the FILE_EVENT to give
510 // us a chance to catch a possible event that might have been triggered.
511 self.register_file_event(helper)
512 }
513
514 // This function returns the full list of events found on the epoll before
515 // iterating through it calling handle_event(). It allows the detection of

Callers

nothing calls this directly

Calls 3

is_ptyMethod · 0.80
register_file_eventMethod · 0.80
trigger_pty_flushMethod · 0.45

Tested by

no test coverage detected