Fix handling of accept() exceptions in threadedserver
Reviewed By: threadz-aditya-tbr
Notes: Propagating fix from TThreadPoolServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664994 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TThreadedServer.cpp b/lib/cpp/src/server/TThreadedServer.cpp
index a06117e..ee0198f 100644
--- a/lib/cpp/src/server/TThreadedServer.cpp
+++ b/lib/cpp/src/server/TThreadedServer.cpp
@@ -102,6 +102,22 @@
thread->start();
} catch (TTransportException& ttx) {
+ inputTransport->close();
+ outputTransport->close();
+ client->close();
+ cerr << "TThreadedServer: TServerTransport died on accept: " << ttx.what() << endl;
+ continue;
+ } catch (TException& tx) {
+ inputTransport->close();
+ outputTransport->close();
+ client->close();
+ cerr << "TThreadedServer: Caught TException: " << tx.what() << endl;
+ continue;
+ } catch (string s) {
+ inputTransport->close();
+ outputTransport->close();
+ client->close();
+ cerr << "TThreadedServer: Unknown exception: " << s << endl;
break;
}
}