From 085267d60c48379f95e838ac487bb69b61b3aa33 Mon Sep 17 00:00:00 2001 From: Aditya Agarwal Date: Tue, 5 Sep 2006 22:49:53 +0000 Subject: [PATCH] -- added stubs for readEnd() and writeEnd() Summary: -- these are hook points that thrift_logger/logfile will integrate with.. Reviewed By: McSlee Test Plan: Generated thrift code Notes: -- Thrift logfiles are soon coming to a netapp near you! git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664787 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_cpp_generator.cc | 4 +++- lib/cpp/src/transport/TTransport.h | 22 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index 7934f0ca..b43ee16b 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -982,6 +982,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, indent() << argsname << " __args;" << endl << indent() << "__args.read(_iprot, itrans);" << endl << indent() << "_iprot->readMessageEnd(itrans);" << endl << + indent() << "itrans->readEnd();" << endl << endl; t_struct* xs = tfunction->get_xceptions(); @@ -1064,7 +1065,8 @@ void t_cpp_generator::generate_process_function(t_service* tservice, indent() << "_oprot->writeMessageBegin(otrans, \"" << tfunction->get_name() << "\", facebook::thrift::protocol::T_REPLY, seqid);" << endl << indent() << "__result.write(_oprot, otrans);" << endl << indent() << "_oprot->writeMessageEnd(otrans);" << endl << - indent() << "otrans->flush();" << endl; + indent() << "otrans->flush();" << endl << + indent() << "otrans->writeEnd();" << endl; // Close function scope_down(f_service_); diff --git a/lib/cpp/src/transport/TTransport.h b/lib/cpp/src/transport/TTransport.h index b2e2a5ba..19a2cb6c 100644 --- a/lib/cpp/src/transport/TTransport.h +++ b/lib/cpp/src/transport/TTransport.h @@ -71,6 +71,17 @@ class TTransport { return have; } + /** + * Called when read is completed. + * This can be over-ridden to perform a transport-specific action + * e.g. logging the request to a file + * + */ + virtual void readEnd() { + // default behaviour is to do nothing + return; + } + /** * Writes the string in its entirety to the buffer. * @@ -81,6 +92,17 @@ class TTransport { throw TTransportException(TTX_NOT_OPEN, "Base TTransport cannot write."); } + /** + * Called when write is completed. + * This can be over-ridden to perform a transport-specific action + * at the end of a request. + * + */ + virtual void writeEnd() { + // default behaviour is to do nothing + return; + } + /** * Flushes any pending data to be written. Typically used with buffered * transport mechanisms. -- 2.17.1