(no ticket) Gracefully terminate the connection handling loop when encountering EOF on the transport layer
Client: Rust
Patch: Sam De Roeck
This closes #1928
diff --git a/lib/rs/src/server/threaded.rs b/lib/rs/src/server/threaded.rs
index ebd3720..5e253f7 100644
--- a/lib/rs/src/server/threaded.rs
+++ b/lib/rs/src/server/threaded.rs
@@ -24,6 +24,7 @@
use {ApplicationError, ApplicationErrorKind};
use super::TProcessor;
+use TransportErrorKind;
/// Fixed-size thread-pool blocking Thrift server.
///
@@ -223,10 +224,15 @@
let mut i_prot = i_prot;
let mut o_prot = o_prot;
loop {
- let r = processor.process(&mut *i_prot, &mut *o_prot);
- if let Err(e) = r {
- warn!("processor completed with error: {:?}", e);
- break;
+ match processor.process(&mut *i_prot, &mut *o_prot) {
+ Ok(()) => {},
+ Err(err) => {
+ match err {
+ ::Error::Transport(ref transport_err) if transport_err.kind == TransportErrorKind::EndOfFile => {},
+ other => warn!("processor completed with error: {:?}", other),
+ }
+ break;
+ }
}
}
}