mirror of
https://github.com/cirruslabs/softnet.git
synced 2026-10-18 22:50:16 +02:00
Support graceful termination via SIGINT (#23)
* Support graceful termination via SIGINT * $ cargo fmt * Explain why we need to ignore the SIGINT
This commit is contained in:
+6
-1
@@ -43,7 +43,7 @@ impl Proxy {
|
||||
self.poller.arm()?;
|
||||
|
||||
loop {
|
||||
let (vm_readable, host_readable) = self.poller.wait()?;
|
||||
let (vm_readable, host_readable, interrupt) = self.poller.wait()?;
|
||||
|
||||
if vm_readable {
|
||||
self.read_from_vm(buf.as_mut_slice())?;
|
||||
@@ -53,6 +53,11 @@ impl Proxy {
|
||||
self.read_from_host(buf.as_mut_slice())?;
|
||||
}
|
||||
|
||||
// Graceful termination
|
||||
if interrupt {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.poller.rearm()?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user