-- 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
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 7934f0c..b43ee16 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -982,6 +982,7 @@
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 @@
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 b2e2a5b..19a2cb6 100644
--- a/lib/cpp/src/transport/TTransport.h
+++ b/lib/cpp/src/transport/TTransport.h
@@ -72,6 +72,17 @@
}
/**
+ * 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.
*
* @param s The string to write out
@@ -82,6 +93,17 @@
}
/**
+ * 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.
*