This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 436bce3  (no ticket) Gracefully terminate the connection handling loop 
when encountering EOF on the transport layer Client: Rust Patch: Sam De Roeck
436bce3 is described below

commit 436bce33215a918ebdc89596bc3c5bfafb33feea
Author: Sam De Roeck <[email protected]>
AuthorDate: Tue Nov 12 17:44:06 2019 +0100

    (no ticket) Gracefully terminate the connection handling loop when 
encountering EOF on the transport layer
    Client: Rust
    Patch: Sam De Roeck
    
    This closes #1928
---
 lib/rs/src/server/threaded.rs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

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 transport::{TIoChannel, TReadTransportFactory, 
TTcpChannel, TWriteTransportF
 use {ApplicationError, ApplicationErrorKind};
 
 use super::TProcessor;
+use TransportErrorKind;
 
 /// Fixed-size thread-pool blocking Thrift server.
 ///
@@ -223,10 +224,15 @@ fn handle_incoming_connection<PRC>(
     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;
+            }
         }
     }
 }

Reply via email to