More boosification of thrift driver, server, transport and protocol code
Modified TestServer to use thread-pool manager
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664737 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TSimpleServer.cc b/lib/cpp/src/server/TSimpleServer.cc
index 7199ab9..2ad5145 100644
--- a/lib/cpp/src/server/TSimpleServer.cc
+++ b/lib/cpp/src/server/TSimpleServer.cc
@@ -13,7 +13,8 @@
* @author Mark Slee <mcslee@facebook.com>
*/
void TSimpleServer::run() {
- TTransport* client = NULL;
+
+ shared_ptr<TTransport> client;
try {
// Start the server listening
@@ -29,8 +30,8 @@
client = serverTransport_->accept();
if (client != NULL) {
// Process for as long as we can keep the processor happy!
- TBufferedTransport bufferedClient(client);
- while (processor_->process(&bufferedClient)) {}
+ shared_ptr<TBufferedTransport> bufferedClient(new TBufferedTransport(client));
+ while (processor_->process(bufferedClient)) {}
}
} catch (TTransportException& ttx) {
if (client != NULL) {
@@ -43,13 +44,7 @@
// Ensure no resource leaks
client->close();
-
- // Ensure no memory leaks
- delete client;
-
- // Ensure we don't try to double-free on the next pass
- client = NULL;
- }
+ }
}
// TODO(mcslee): Could this be a timeout case? Or always the real thing?