THRIFT-265. cpp: Reset buffers every 512 calls in TNonblockingServer
Author: Erik Frey
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@750153 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TNonblockingServer.h b/lib/cpp/src/server/TNonblockingServer.h
index cf024ed..40ec574 100644
--- a/lib/cpp/src/server/TNonblockingServer.h
+++ b/lib/cpp/src/server/TNonblockingServer.h
@@ -248,6 +248,12 @@
// How far through writing are we?
uint32_t writeBufferPos_;
+ // How many times have we read since our last buffer reset?
+ uint32_t numReadsSinceReset_;
+
+ // How many times have we written since our last buffer reset?
+ uint32_t numWritesSinceReset_;
+
// Task handle
int taskHandle_;
@@ -304,6 +310,9 @@
}
readBufferSize_ = 1024;
+ numReadsSinceReset_ = 0;
+ numWritesSinceReset_ = 0;
+
// Allocate input and output tranpsorts
// these only need to be allocated once per TConnection (they don't need to be
// reallocated on init() call)