summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Duxbury <bryanduxbury@apache.org>2011-06-30 18:59:18 +0000
committerBryan Duxbury <bryanduxbury@apache.org>2011-06-30 18:59:18 +0000
commit2323aa9c1cd7926d68b487013f847b4b2bf85bb0 (patch)
tree383bc95f118118b10a642dbb139774d27aa56ca7
parentad0ad824d2fb8c68b77e4a8a982225cf879f878d (diff)
downloadthrift-2323aa9c1cd7926d68b487013f847b4b2bf85bb0.tar.gz
THRIFT-1228. php: The php accelerator module calls flush incorrectly
This patch makes sure that filling the php extension's internal buffer does not cause a premature flush of the whole transport. Patch: Nathaniel Cook git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1141668 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
index 253026d57..3e32cb927 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
@@ -177,7 +177,7 @@ public:
void write(const char* data, size_t len) {
if ((len + buffer_used) > buffer_size) {
- flush();
+ internalFlush();
}
if (len > buffer_size) {
directWrite(data, len);
@@ -218,15 +218,18 @@ public:
}
void flush() {
- if (buffer_used) {
+ internalFlush();
+ directFlush();
+ }
+
+protected:
+ void internalFlush() {
+ if (buffer_used) {
directWrite(buffer, buffer_used);
buffer_ptr = buffer;
buffer_used = 0;
}
- directFlush();
}
-
-protected:
void directFlush() {
zval ret;
ZVAL_NULL(&ret);