Add kill switch functionality
Added shutdown event-fd acting as a kill switch actionable from outside the micro-http server. Needed to be able to break out of the inner epoll_wait on demand. This can be used to signal the micro-http server running on a dedicated thread that it needs to shut down. Co-authored-by: acatangiu <adrian.catangiu@gmail.com> Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
This commit is contained in:
committed by
Jonathan Woollett-Light
parent
b538bf89e5
commit
3c5d9407d3
@@ -166,12 +166,14 @@ pub enum ServerError {
|
||||
ConnectionError(ConnectionError),
|
||||
/// Epoll operations failed.
|
||||
IOError(std::io::Error),
|
||||
/// Overflow occured while processing messages.
|
||||
/// Overflow occurred while processing messages.
|
||||
Overflow,
|
||||
/// Server maximum capacity has been reached.
|
||||
ServerFull,
|
||||
/// Underflow occured while processing mesagges.
|
||||
/// Underflow occurred while processing messages.
|
||||
Underflow,
|
||||
/// Shutdown requested.
|
||||
ShutdownEvent,
|
||||
}
|
||||
|
||||
impl Display for ServerError {
|
||||
@@ -182,6 +184,7 @@ impl Display for ServerError {
|
||||
Self::Overflow => write!(f, "Overflow occured while processing messages."),
|
||||
Self::ServerFull => write!(f, "Server is full."),
|
||||
Self::Underflow => write!(f, "Underflow occured while processing messages."),
|
||||
Self::ShutdownEvent => write!(f, "Shutdown requested."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user