From e574a065a9ed100bda718582dc3378abc2933e78 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 9 Mar 2010 05:19:22 +0000 Subject: [PATCH] THRIFT-660. php: Use the accelerator to write return values from servers Previously, we only used the acclerator module for clients to write calls and read returns. Now PHP servers will use it for writing returns. We cannot use it to read calls on the server side (without modifications), because the module requires that the structure type be known before reading the message header. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920663 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_php_generator.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc index 38a63faa..3532eb09 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -1134,6 +1134,21 @@ void t_php_generator::generate_process_function(t_service* tservice, return; } + f_service_ << + indent() << "$bin_accel = ($output instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary');" << endl; + + f_service_ << + indent() << "if ($bin_accel)" << endl; + scope_up(f_service_); + + f_service_ << + indent() << "thrift_protocol_write_binary($output, '" << tfunction->get_name() << "', TMessageType::REPLY, $result, $seqid, $output->isStrictWrite());" << endl; + + scope_down(f_service_); + f_service_ << + indent() << "else" << endl; + scope_up(f_service_); + // Serialize the request header if (binary_inline_) { f_service_ << @@ -1151,6 +1166,8 @@ void t_php_generator::generate_process_function(t_service* tservice, indent() << "$output->getTransport()->flush();" << endl; } + scope_down(f_service_); + // Close function indent_down(); f_service_ << -- 2.17.1