Refactor the reader/dispatcher

The previous design did not handled errors correctly and was kind of
spaghetti code. With the new one, the reader and the dispatcher are
clearly separated. The filter will only exit on an error from the reader
or if EOF has been reached, any other error is displayed but does not
exit the filter, which is required by the API. If the filter must exit,
all threads are gracefully stopped.
This commit is contained in:
Rodolphe Breard 2018-12-29 20:22:37 +01:00
parent b5cfe79947
commit 24b332c615
3 changed files with 77 additions and 38 deletions

View file

@ -1,6 +1,3 @@
fn main() {
match opensmtpd::dispatch() {
Ok(_) => {}
Err(e) => eprintln!("Error: {}", e.as_str()),
}
opensmtpd::run();
}