common/thrift.git
14 years agoTHRIFT-991: Refactor Haskell code and generator. Part 1: clean up code generator...
Christian Lavoie [Sun, 7 Nov 2010 18:37:11 +0000 (18:37 +0000)] 
THRIFT-991: Refactor Haskell code and generator. Part 1: clean up code generator style.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1032342 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-970. java: Under heavy load, THttpClient may fail with 'too many open files'
Bryan Duxbury [Fri, 5 Nov 2010 17:14:52 +0000 (17:14 +0000)] 
THRIFT-970. java: Under heavy load, THttpClient may fail with 'too many open files'

This patch updates our THttpClient to have two different modes of operation: its current functionality and a new mode that uses Apache's HttpClient library to provide higher throughput and better pooling functionality.

Patch: Mathias Herberts

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1031668 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-916: Fix warnings in C++ when compiling with -Wall.
Christian Lavoie [Thu, 4 Nov 2010 20:35:15 +0000 (20:35 +0000)] 
THRIFT-916: Fix warnings in C++ when compiling with -Wall.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1031222 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-953: Fix compilation of TransportTest.cpp on Mac (actual tests still fail...
Christian Lavoie [Thu, 4 Nov 2010 18:51:42 +0000 (18:51 +0000)] 
THRIFT-953: Fix compilation of TransportTest.cpp on Mac (actual tests still fail) and fix boost m4 macros for Mac.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1031148 13f79535-47bb-0310-9956-ffa450edef68

14 years agochange URL's to TLP
Roger Meier [Thu, 4 Nov 2010 12:20:05 +0000 (12:20 +0000)] 
change URL's to TLP

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1030901 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-977. cpp: Hex Conversion Bug in C++ TJSONProtocol
Bryan Duxbury [Wed, 3 Nov 2010 17:57:38 +0000 (17:57 +0000)] 
THRIFT-977. cpp: Hex Conversion Bug in C++ TJSONProtocol

This patch fixes a silly bug in hex-to-int conversion in TSJONProtocol.

Patch: Aravind Narayanan

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1030576 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-950: Haskell bindings treat 'byte' as unsigned 8-bit int (Data.Word.Word8...
Christian Lavoie [Tue, 2 Nov 2010 21:42:53 +0000 (21:42 +0000)] 
THRIFT-950: Haskell bindings treat 'byte' as unsigned 8-bit int (Data.Word.Word8), java/cpp as signed (byte/int8_t). Fix Haskell.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1030243 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-893 JavaScript Tutorial: dynamic part
Roger Meier [Tue, 2 Nov 2010 12:36:52 +0000 (12:36 +0000)] 
THRIFT-893 JavaScript Tutorial: dynamic part

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1030018 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-6 TLP URL's and email's, haskell, more details
Roger Meier [Tue, 2 Nov 2010 07:33:30 +0000 (07:33 +0000)] 
THRIFT-6 TLP URL's and email's, haskell, more details

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1029964 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-975 minimal README added
Roger Meier [Fri, 29 Oct 2010 05:14:54 +0000 (05:14 +0000)] 
THRIFT-975 minimal README added

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1028617 13f79535-47bb-0310-9956-ffa450edef68

14 years agoThrift now a TLP - INFRA-3116
Gavin McDonald [Thu, 28 Oct 2010 02:12:01 +0000 (02:12 +0000)] 
Thrift now a TLP - INFRA-3116

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1028168 13f79535-47bb-0310-9956-ffa450edef68

14 years agoimprove formatting in TProtocolUtil.skip
Bryan Duxbury [Wed, 27 Oct 2010 23:39:58 +0000 (23:39 +0000)] 
improve formatting in TProtocolUtil.skip

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028140 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-377. java: TFileTransport port in Java
Bryan Duxbury [Wed, 27 Oct 2010 23:26:52 +0000 (23:26 +0000)] 
THRIFT-377. java: TFileTransport port in Java

This patch adds TFileTransport to the java library. This transport is not a general-purpose file transport; instead, it is more of a way to execute one-way RPC via an offline file process.

Patch: Joydeep Sen Sarma

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028136 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-517. java:TExceptions thrown by server result in cryptic error message on...
Bryan Duxbury [Wed, 27 Oct 2010 23:15:35 +0000 (23:15 +0000)] 
THRIFT-517. java:TExceptions thrown by server result in cryptic error message on client - Tried to read 4 bytes, but only got 0 bytes

This tiny change improves the message to make it marginally more obvious that the server-side might be the culprit.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028131 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-969 Java Tutorial broken, move CalculatorHandler to a separate file
Roger Meier [Wed, 27 Oct 2010 19:39:56 +0000 (19:39 +0000)] 
THRIFT-969 Java Tutorial broken, move CalculatorHandler to a separate file

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028079 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-971 java module can't be compiled without ivy and network connection
Roger Meier [Wed, 27 Oct 2010 19:19:04 +0000 (19:19 +0000)] 
THRIFT-971 java module can't be compiled without ivy and network connection

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028075 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-949. java: Modify the TEnum interface so it defines a method similar to findBy...
Bryan Duxbury [Wed, 27 Oct 2010 17:54:10 +0000 (17:54 +0000)] 
THRIFT-949. java: Modify the TEnum interface so it defines a method similar to findByValue

This patch adds a new helper class that makes it easier to get instances of generic TEnum descendents by value.

Patch: Mathias Herberts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028051 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-582 C(c_glib) implementation of Thrift
Roger Meier [Wed, 27 Oct 2010 12:30:11 +0000 (12:30 +0000)] 
THRIFT-582 C(c_glib) implementation of Thrift

Patch: Anatol Pomozov and Michael Lum

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1027933 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-960 Java: remove TestServer, TestNonblockingServer and TestClient from Unittest
Roger Meier [Mon, 25 Oct 2010 19:57:26 +0000 (19:57 +0000)] 
THRIFT-960 Java: remove TestServer, TestNonblockingServer and TestClient from Unittest

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1027248 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-916 partial commit of v3-fix-all-warnings.patch and member initialization...
Roger Meier [Mon, 25 Oct 2010 12:36:04 +0000 (12:36 +0000)] 
THRIFT-916 partial commit of v3-fix-all-warnings.patch and member initialization in Thrift.h

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1027092 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-961 JavaScript TestSuite using ant/ivy and Java's ServerTestBase Handler
Roger Meier [Sun, 24 Oct 2010 21:41:24 +0000 (21:41 +0000)] 
THRIFT-961 JavaScript TestSuite using ant/ivy and Java's ServerTestBase Handler

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026899 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-960 switch back to TThreadPoolServer with AbstractServerArgs
Roger Meier [Sat, 23 Oct 2010 23:50:48 +0000 (23:50 +0000)] 
THRIFT-960 switch back to TThreadPoolServer with AbstractServerArgs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026714 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-960 update to use AbstractServerArgs
Roger Meier [Sat, 23 Oct 2010 23:35:46 +0000 (23:35 +0000)] 
THRIFT-960 update to use AbstractServerArgs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026712 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-960 Java: add TestServer, TestNonblockingServer and TestClient again
Roger Meier [Sat, 23 Oct 2010 22:25:04 +0000 (22:25 +0000)] 
THRIFT-960 Java: add TestServer, TestNonblockingServer and TestClient again

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026704 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-6 csharp AssemblyInfo added
Roger Meier [Sat, 23 Oct 2010 22:16:51 +0000 (22:16 +0000)] 
THRIFT-6 csharp AssemblyInfo added

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026700 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-6 accidently changed name of ThriftMSBuildTask to Thrift, reverted
Roger Meier [Sat, 23 Oct 2010 22:01:54 +0000 (22:01 +0000)] 
THRIFT-6 accidently changed name of ThriftMSBuildTask to Thrift, reverted

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026690 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-745. java: Make it easier to instantiate servers
Bryan Duxbury [Fri, 22 Oct 2010 20:23:57 +0000 (20:23 +0000)] 
THRIFT-745. java: Make it easier to instantiate servers

This patch replaces the multitude of constructors with builder-esque Args objects for each server and single constructor.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026482 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-6 update Version Info for several languages, add print-version to Makefile.am
Roger Meier [Fri, 22 Oct 2010 11:20:25 +0000 (11:20 +0000)] 
THRIFT-6 update Version Info for several languages, add print-version to Makefile.am

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1026299 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-959. java: TSocket seems to do its own buffering inefficiently
Bryan Duxbury [Wed, 20 Oct 2010 19:04:07 +0000 (19:04 +0000)] 
THRIFT-959. java: TSocket seems to do its own buffering inefficiently

This patch removes the buffering from TSocket. This seems to improve performance marginally on small reads and writes that are buffered elsewhere (like the Framed Transport).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1025678 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-947. java: Provide a helper method to determine the TProtocol used to serializ...
Bryan Duxbury [Tue, 19 Oct 2010 23:00:27 +0000 (23:00 +0000)] 
THRIFT-947. java: Provide a helper method to determine the TProtocol used to serialize some data.

Patch: Mathias Herberts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1024455 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-957. java: THsHaServer: Change access modifier of the invoker field.
Bryan Duxbury [Tue, 19 Oct 2010 18:06:45 +0000 (18:06 +0000)] 
THRIFT-957. java: THsHaServer: Change access modifier of the invoker field.

This patch adds a new overridable method to allow subclasses to specify their own Runnable implementation.

Patch: Benjamin Coverston

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1024343 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-106. java: TSSLServerSocket
Bryan Duxbury [Tue, 19 Oct 2010 17:20:57 +0000 (17:20 +0000)] 
THRIFT-106. java: TSSLServerSocket

This patch adds support for SSL-encrypted client and server sockets.

Patch: Nirmal Ranganathan

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1024328 13f79535-47bb-0310-9956-ffa450edef68

14 years agocpp: Support oneway calls in TDebugProtocol.cpp
David Reiss [Mon, 18 Oct 2010 17:25:40 +0000 (17:25 +0000)] 
cpp: Support oneway calls in TDebugProtocol.cpp

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023913 13f79535-47bb-0310-9956-ffa450edef68

14 years agocpp: Add a little extra whitespace to TDebugProtocol.cpp
David Reiss [Mon, 18 Oct 2010 17:25:13 +0000 (17:25 +0000)] 
cpp: Add a little extra whitespace to TDebugProtocol.cpp

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023912 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-916 gcc warnings(partial) use snprintf instead of sprintf
Roger Meier [Mon, 18 Oct 2010 08:22:57 +0000 (08:22 +0000)] 
THRIFT-916 gcc warnings(partial) use snprintf instead of sprintf

Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023682 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-916 t_java_generator.cc: remove compiler warnings for enumerations not handled...
Roger Meier [Sat, 16 Oct 2010 15:54:36 +0000 (15:54 +0000)] 
THRIFT-916 t_java_generator.cc: remove compiler warnings for enumerations not handled in switch

Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023317 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-893 add JavaScript to the tutorial example (html only)
Roger Meier [Fri, 15 Oct 2010 19:24:32 +0000 (19:24 +0000)] 
THRIFT-893  add JavaScript to the tutorial example (html only)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023077 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-807 JavaScript: Initialization of Base Types with 0 instead of null
Roger Meier [Fri, 15 Oct 2010 19:12:44 +0000 (19:12 +0000)] 
THRIFT-807 JavaScript: Initialization of Base Types with 0 instead of null

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023073 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-958. java: Change accessmodifer on trans_ field in the FrameBuffer class to...
Bryan Duxbury [Fri, 15 Oct 2010 16:40:34 +0000 (16:40 +0000)] 
THRIFT-958. java: Change accessmodifer on trans_ field in the FrameBuffer class to public.

Patch: Benjamin Coverston

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023008 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-913 Test Case for Url encoded strings + simple enhancement to lib/js/test...
Roger Meier [Fri, 15 Oct 2010 13:16:05 +0000 (13:16 +0000)] 
THRIFT-913 Test Case for Url encoded strings + simple enhancement to lib/js/test/RunTestServer.sh
and ignore gen-* and *.class

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1022907 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-955 remove CharLowerBuff function for mingw based Thrift Compiler
Roger Meier [Thu, 14 Oct 2010 17:56:03 +0000 (17:56 +0000)] 
THRIFT-955 remove CharLowerBuff function for mingw based Thrift Compiler
=> no lowercase names and directories which was inconsistent for using across different platforms

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1022630 13f79535-47bb-0310-9956-ffa450edef68

14 years agoignore a few test binaries
Roger Meier [Wed, 13 Oct 2010 20:02:54 +0000 (20:02 +0000)] 
ignore a few test binaries

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1022274 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-916 no errors on GNU/Linux when compiling with CXXFLAGS="-Wall -Wextra -pedantic"
Roger Meier [Wed, 13 Oct 2010 18:10:18 +0000 (18:10 +0000)] 
THRIFT-916 no errors on GNU/Linux when compiling with CXXFLAGS="-Wall -Wextra -pedantic"

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1022220 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-951. java: Add a new isServing() method to TServer
Bryan Duxbury [Tue, 12 Oct 2010 22:32:23 +0000 (22:32 +0000)] 
THRIFT-951. java: Add a new isServing() method to TServer

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021941 13f79535-47bb-0310-9956-ffa450edef68

14 years agospacing cleanup
Bryan Duxbury [Mon, 11 Oct 2010 22:13:23 +0000 (22:13 +0000)] 
spacing cleanup

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021535 13f79535-47bb-0310-9956-ffa450edef68

14 years agoclear a bunch of java warnings, unused code and imports, etc
Bryan Duxbury [Mon, 11 Oct 2010 22:01:27 +0000 (22:01 +0000)] 
clear a bunch of java warnings, unused code and imports, etc

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021531 13f79535-47bb-0310-9956-ffa450edef68

14 years agoupdate svn:ignore in test/py.twisted
Bryan Duxbury [Mon, 11 Oct 2010 21:56:50 +0000 (21:56 +0000)] 
update svn:ignore in test/py.twisted

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021528 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-952. TBinarySerializer utility class for converting between byte strings and...
Mark Slee [Mon, 11 Oct 2010 21:45:13 +0000 (21:45 +0000)] 
THRIFT-952. TBinarySerializer utility class for converting between byte strings and PHP objects

Adds a nice TBinarySerializer class to make it simple to convert between PHP objects and serialized strings using the Binary protocol.

Patch: Radu Marin

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021521 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926 Miscellaneous C++ improvements
Roger Meier [Fri, 8 Oct 2010 21:23:35 +0000 (21:23 +0000)] 
THRIFT-926 Miscellaneous C++ improvements

changing single destructor call time limit from 500us to 1000us
build does not fail on busy machines

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1006030 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-581 Add a testsuite for txThrift (Twisted) / py.twisted
Roger Meier [Fri, 8 Oct 2010 17:46:06 +0000 (17:46 +0000)] 
THRIFT-581 Add a testsuite for txThrift (Twisted) / py.twisted

Patch: Esteve Fernandez

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005923 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-862. java: Async client issues / improvements
Bryan Duxbury [Wed, 6 Oct 2010 20:04:40 +0000 (20:04 +0000)] 
THRIFT-862. java: Async client issues / improvements

This patch improves quite a large number of things about the async client code.

Patch: Ning Liang

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005221 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-946. java: Augment FieldValueMetaData so it differentiates 'string' and 'binar...
Bryan Duxbury [Wed, 6 Oct 2010 20:00:03 +0000 (20:00 +0000)] 
THRIFT-946. java: Augment FieldValueMetaData so it differentiates 'string' and 'binary' fields.

This patch adds a new method to the FieldMetaData class that indicates binary or not.

Patch: Mathias Herberts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005220 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-927. php: Option to support modifying the PHP include path
David Reiss [Wed, 6 Oct 2010 17:10:55 +0000 (17:10 +0000)] 
THRIFT-927. php: Option to support modifying the PHP include path

Make the PHP generator recognize a new-style namespace called "php.path".
If it is present, it is segmented and used as a path to include the
generated code.  (It goes between "packages" and the Thrit file basename.)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005172 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Better exception handling in TSimpleServer
David Reiss [Wed, 6 Oct 2010 17:10:54 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Better exception handling in TSimpleServer

Move processing code out of main try block and created individual
try/catch's for closing down the client and it's transports (to avoid
issues with throwing exceptions from a catch block).

Also converted to using GlobalOutput instead of cerr.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005171 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: remove auto-stringification in TLogging.h
David Reiss [Wed, 6 Oct 2010 17:10:53 +0000 (17:10 +0000)] 
THRIFT-926. cpp: remove auto-stringification in TLogging.h

The T_DEBUG* and T_ERROR* macros used preprocessor stringification to
stringify the format string argument.  This was weird and unintuitive.

With the old behavior:

- Quotes surrounding the format string were included in the message:
  T_DEBUG("this is a test") --> expanded to  "\"this is a test\""

- Backslashes in the string are escaped so they print literally:
  T_DEBUG("foo\nbar")       --> expanded to  "\"foo\\nbar\""

- Standard fixed-width integer format macros don't work:
  T_DEBUG("x: %" PRIi64, x) --> expanded to  "\"x: %\" PRIi64"

The last item is particularly problematic, since it prevents 64-bit
values from being logged portably.

With the new code, the following will no longer compile:

  T_DEBUG(this is my log message: %d, 5)

I don't think that is a bad thing, though.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005170 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Better buffer management for TNonblockingServer
David Reiss [Wed, 6 Oct 2010 17:10:52 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Better buffer management for TNonblockingServer

Add two improvements to memory management in TNonblocking server:
- Separate the receive code into two distinct states: one for receiving
  the frame header and one for the frame content.  This allows us to
  size the initial read buffer based on the initial frame size, rather
  than allocating an arbitrary amount of memory before reading the
  header.
- Allow setting the initial write buffer size based on the application's
  expected response size.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005169 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Let TMemoryBuffer::resetBuffer() set size of self-allocated buffer
David Reiss [Wed, 6 Oct 2010 17:10:51 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Let TMemoryBuffer::resetBuffer() set size of self-allocated buffer

Although there is a constructor that allows a TMemoryBuffer to be
created with an internally-allocated buffer of a desired size, there was
no way for resetBuffer to obtain analogous behavior. This change causes
the appropriate constructor to be used.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005168 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Thrift: throw bad_alloc when malloc fails, not something else
David Reiss [Wed, 6 Oct 2010 17:10:49 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Thrift: throw bad_alloc when malloc fails, not something else

When malloc/realloc fail, we've typically just thrown a TException. This
allows a server that should simply crash when out of memory to survive
in a strage state, with various bad consequences. Instead, we should
throw bad_alloc and just not catch it (or if we decide to, be very
careful to respond properly).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005167 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: TFramedTransport: Uphold the strong exception safety guarantee
David Reiss [Wed, 6 Oct 2010 17:10:47 +0000 (17:10 +0000)] 
THRIFT-926. cpp: TFramedTransport: Uphold the strong exception safety guarantee

Previously, if we had a new[] failure when growing a TFramedTransport
write buffer, we would leave the buffer in an invalid state (wBufSize_
would reflect the desired size, rather than the actual size).  Now, we
make no change to any member variables if new[] fails.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005166 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: TMemoryBuffer: Uphold the strong exception safety guarantee
David Reiss [Wed, 6 Oct 2010 17:10:46 +0000 (17:10 +0000)] 
THRIFT-926. cpp: TMemoryBuffer: Uphold the strong exception safety guarantee

Previously, if we had a realloc failure when growing a TMemoryBuffer, we
would leave the buffer in an invalid state (bufferSize_ would reflect
the desired size, rather than the actual size).  Now, we make no change
to any member variables if realloc fails.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005165 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Add configurable buffer recycling for TNonblockingServer
David Reiss [Wed, 6 Oct 2010 17:10:45 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Add configurable buffer recycling for TNonblockingServer

Add methods to TNonblockingServer to set the maximum size of idle read
and write buffers and the check interval (in calls).  When checked, if
the buffers are larger than the configured maximum, they will be resized
down the to maximum size.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005164 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Revert r750153 to make way for more flexible version
David Reiss [Wed, 6 Oct 2010 17:10:43 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Revert r750153 to make way for more flexible version

r750153 caused TNonblockingServer to reset its buffers every 512 calls.
A more configurable version was developed internally, so I'm reverting
this rev first to avoid conflicts.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005163 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Convert tests to use boost 1.37
David Reiss [Wed, 6 Oct 2010 17:10:42 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Convert tests to use boost 1.37

The boost test framework has changed significantly from boost 1.34 to
1.37.  Quite a few new features have been added, and some annoying bugs
have been fixed.

This change now builds the thrift tests against boost 1.37, and updates
them to use some of the newer features.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005162 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Fix inconsistencies in transport read() behavior
David Reiss [Wed, 6 Oct 2010 17:10:40 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Fix inconsistencies in transport read() behavior

- TBufferedTransport::borrow() could block if not enough data was
  available.  Now it returns NULL immediately in this case, like all
  other transports.

- TBufferedTransport::read() could block some data was available in the
  readahead buffer, but not enough to satisfy the request.  It would
  attempt to call read() on the underlying transport, but this might
  block.  Now it just returns the remaining data in the readahead
  buffer.  The caller is responsible for calling read() again to get the
  rest of the data they want.

- TFrameTransport::read() threw an exception if read() on the underlying
  transport returned 0 when looking for a frame header.  Now
  TFrameTransport::read() returns 0, too.  (It still throws an exception
  if the underlying transport returns 0 after a partial frame or frame
  header has been read.)

- TFDTransport::read() threw an exception on EINTR.  Now it retries up
  to 5 times, similarly to the way TSocket::read() behaves.

- TZlibTransport::read() could block when less data than was requested
  is available.  Now it only calls read() on the underlying transport
  when it would otherwise have nothing to return.

  This does mean that TZlibTransport::read() now often returns less data
  than is actually available at the time.  This required updating
  several of the ZlibTest tests to use readAll() instead of read(),
  since they previously assumed read() would return all available data.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005161 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Add tests to verify blocking read behavior
David Reiss [Wed, 6 Oct 2010 17:10:38 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Add tests to verify blocking read behavior

Add tests that check to see whether or not read() and borrow() block
when called with a length larger than the amount of data currently
available.

At the moment, not all of the transports behave the same way.  I believe
the desired behavior is:

  When M bytes are available, and 0 < M < N:
  - read(N): return M bytes immediately
  - borrow(N): return NULL immediately

  When 0 bytes are available:
  - read(N): In this case, it is acceptable either to immediately return
    0, or to block until some data is available.  If the transport
    blocks, it returns immediately when some date becomes available,
    even if less than N bytes are available.
  - borrow(N): return NULL immediately

- The borrow() tests fail when using TBufferedTransport.
  TBufferedTransport incorrectly blocks until the amount of data
  requested is available.

- test_read_none_available() fails when using TFramedTransport.
  Calling read() on a TFramedTransport when no data is available throws
  an exception instead of returning 0.

- test_read_none_available() fails when using TFDTransport.  This is
  partly just an artifact of the fact that I use SIGALRM as part of this
  test.  Unlike TSocket, TFDTransport doesn't retry after EINTR.

- test_read_part_available() fails when using TZlibTransport around a
  transport that has blocking read() behavior.  TZlibTransport::read()
  loops calling read() on the underlying transport.  It should probably
  break out of the loop and return to the caller as soon as it has
  uncompressed any data, even if it is less than requested and more
  might be available.  Once some data has been uncompressed,
  TZlibTransport cannot risk calling read() again since it might block.

Will commit fixes for these separately.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005160 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Test wrapper transports more thoroughly
David Reiss [Wed, 6 Oct 2010 17:10:37 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Test wrapper transports more thoroughly

UpdateS TransportTest so that the wrapper transports
(TBufferedTransport, TFramedTransport, TZlibTransport) are tested with a
wider variety of inner transports.  Previously they were only tested
using TMemoryBuffer.  Now all other transports are also tested wrapped
inside each of these transports.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005159 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Update TransportTest to test TSocket
David Reiss [Wed, 6 Oct 2010 17:10:36 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Update TransportTest to test TSocket

Made the TSocket(int fd) constructor public, so TransportTest can create
a connected pair of TSocket transports using socketpair().

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005158 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Reduce default buffer sizes for TransportTest
David Reiss [Wed, 6 Oct 2010 17:10:35 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Reduce default buffer sizes for TransportTest

Reduce the default test buffer sizes by about 30x, reducing the time it
takes to run TransportTest from about 1 minute to about 2 seconds.  I
added a --size-multiplier argument that can be used to adjust the sizes
of all test buffers, so developers can still run with large buffer sizes
when desired.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005157 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Fix bugs in TFileTransport::flush()
David Reiss [Wed, 6 Oct 2010 17:10:33 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Fix bugs in TFileTransport::flush()

Previously flush() had race conditions that could cause it to return
before all data had actually been flushed to disk.  Now the writer
makes sure both buffer queues have been flushed when forceFlush_ is set.

Also, flush() did not wake up the writer thread, so it normally had to
wait for the writer thread to wake up on its own time.  (By default,
this could take up to 3 seconds.)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005156 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: TFileTransportTest timing slightly more lenient
David Reiss [Wed, 6 Oct 2010 17:10:31 +0000 (17:10 +0000)] 
THRIFT-926. cpp: TFileTransportTest timing slightly more lenient

Several of the TFileTransportTest tests check wall clock time to make
sure the writer thread processes operations quickly enough, and isn't
hanging.  However, this can easily result in false failures if we don't
get enough processor time.  This commit makes a few changes to reduce
the number of these failures.

- No longer fail if a single destructor call takes more than 500us.
  We only require 90% of the calls to complete in 500us.  No call may
  take more than 100ms, though.  With this change, the test passes most
  of the time now, even while an "fbmake opt" task is running in
  parallel.

- In the flush_max_us tests, make sure the writer thread is started
  before we start recording timing.  Otherwise, creating the thread
  could take long enough to throw off the numbers for the first fsync()
  call.

Also tested with the pthread_cond_signal() in the TFileTransport
destructor commented out, to make sure the test still fails properly
when the destructor takes too long.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005155 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Fix destructor behavior of TFileTransport
David Reiss [Wed, 6 Oct 2010 17:10:30 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Fix destructor behavior of TFileTransport

Set closing_ to true before we wake up the writer thread in the
destructor.  This way the writer thread flushes the data and exits when
it is woken up.

Previously the writer thread could end up going through 2 full timeout
cycles before exiting.  The writer thread could wake up, notice it has
nothing to do since closing_ is not set, and immediately go back to
sleep.  The destructor would then proceed to call flush(), which would
wait for the writer thread to wake up (1 full time out) and clear the
forceFlush_ flag.  After flush returns, the destructor would set
closing_.  It could take the writer thread another full timeout to wake
up again and process this flag.

There were also some points where the worker threads would detect the
closing_ state in their loops and automatically close the file, but did
not zero out the file descriptor, then the destructer attempted to close
the same file.  Fix by simply zeroing out the fd_ at these points.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005154 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Don't sleep in TFileTransport if we have data to write
David Reiss [Wed, 6 Oct 2010 17:10:29 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Don't sleep in TFileTransport if we have data to write

Previously, the TFileTransport writer thread behaved as follows:

  while true:
    wait for main thread to notify new data in enqueueBuffer_
    swap(enqueueBuffer_, dequeueBuffer_)
    write out everything in dequeueBuffer_

Now the behavior is:

  while true:
    if enqueueBuffer_ is empty
      wait for main thread to notify new data in enqueueBuffer_
    swap(enqueueBuffer_, dequeueBuffer_)
    write out everything in dequeueBuffer_

The old behavior had a couple problems:
- Writes that arrived while the writer thread was writing
  dequeueBuffer_ wouldn't get processed immediately.  The writer thread
  would always wait until another write occurred after it started its
  condition variable wait, or until it timed out (3 seconds by default).

- If the main thread was writing fast enough to fill up enqueueBuffer_
  while the writer thread was still writing out dequeueBuffer_, it would
  block the next write call until the writer thread swapped the buffers.
  Unfortunately, the writer thread waits to do this until it the main
  thread notifies it of another write.  This deadlock is only broken by
  the 3 second timeout.  Performance then tanks, since the writer thread
  now always sleeps 3 seconds each time around the loop.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005153 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: remove "standalone" distinction in TZlibTransport
David Reiss [Wed, 6 Oct 2010 17:10:27 +0000 (17:10 +0000)] 
THRIFT-926. cpp: remove "standalone" distinction in TZlibTransport

Now that TZlibTransport::flush() behaves the same way as other
transports, there is no need to distinguish between RPC and standalone
behavior for TZlibTransport.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005152 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Make TZlibTransport::flush() behave like other transports
David Reiss [Wed, 6 Oct 2010 17:10:26 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Make TZlibTransport::flush() behave like other transports

Previously, TZlibTransport::flush() finished the zlib stream, so calling
write() after flush() would result in an error.  Now it just flushes the
data, without finishing the stream.  A new TZlibTransport::finish()
function has been added to finish the stream.

This breaks compatibility.  I'm aware of anyone using this code outside
of Facebook, though.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005151 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Use boost::lognormal_distribution in ZlibTest
David Reiss [Wed, 6 Oct 2010 17:10:24 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Use boost::lognormal_distribution in ZlibTest

This way we no longer have to have a huge hard-coded list of numbers in
the source code.  The distribution is randomly generated for each run.
(Although the --seed argument can be used for repeatablity.)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005150 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Convert ZlibTest to use the boost unit test framework
David Reiss [Wed, 6 Oct 2010 17:10:23 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Convert ZlibTest to use the boost unit test framework

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005149 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Remove TZlibTest dependency on filesystem data
David Reiss [Wed, 6 Oct 2010 17:10:21 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Remove TZlibTest dependency on filesystem data

Previously, ZlibTest read a file from disk to get data to test with.
It would fail unless gen-cpp/DebugProtoTest_types.tcc was present in the
current directory and was at least 32kB long.

Now ZlibTest simply generates 3 separate buffers to test with.  The
first buffer is just all "a"s, the second is some random sequential
runs, and the third is completely random.  They usually seem to have
compression ratios of around 315:1, 4:1, and 1:1, respectively.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005148 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Fix a couple minor issues in ZlibTest
David Reiss [Wed, 6 Oct 2010 17:10:20 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Fix a couple minor issues in ZlibTest

- Add a necessary cast.
- Check buffer sizes more carefully to allow for different read/write
  size distributions.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005147 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-929. cpp: Add unit test for transport functionality
David Reiss [Wed, 6 Oct 2010 17:10:19 +0000 (17:10 +0000)] 
THRIFT-929. cpp: Add unit test for transport functionality

Tests various transport types by writing data, and verifying it can be
read back successfully.  Tests both virtual calls (accessed as
TTransport*) and non-virtual calls (accessed as the appropriate pointer
type, or as TBufferBase* when appropriate).

This is similar to some of the tests already performed in
TMemoryBufferTest and ZlibTest.cpp.  However, this tests a few more
transport types, and it interleaves read and write calls more heavily.
(It currently exposes some bugs in flush() in a couple transports.) It
also exercises both the virtual and non-virtual code paths, now that
read() and write() only result in virtual calls when invoked on a
TTransport*.

TFileTransport currently has several race condition bugs, so most of the
TFileTransport tests ususally fail.  It also has some performance bugs,
causing the TFileTransport tests to take a long time.  Will fix those
issues separately.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005146 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: TNonblockingServer: use TSocket and support TClientInfo
David Reiss [Wed, 6 Oct 2010 17:10:17 +0000 (17:10 +0000)] 
THRIFT-928. cpp: TNonblockingServer: use TSocket and support TClientInfo

Modify TNonblockingServer to use TSocket for I/O and support server
event handlers; this enables TClientInfo to function with a minor change
to the processing loop.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005145 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Remove TServerSocket as a friend class of TSocket
David Reiss [Wed, 6 Oct 2010 17:10:16 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Remove TServerSocket as a friend class of TSocket

This is no longer necessary now that TSocket::TSocket(int) is public.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005144 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-925. cpp: Add _VALUES_TO_NAMES enum map
David Reiss [Wed, 6 Oct 2010 17:10:15 +0000 (17:10 +0000)] 
THRIFT-925. cpp: Add _VALUES_TO_NAMES enum map

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005143 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-924. php: Fix missing comma in generated PHP struct constants
David Reiss [Wed, 6 Oct 2010 17:10:13 +0000 (17:10 +0000)] 
THRIFT-924. php: Fix missing comma in generated PHP struct constants

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005142 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-926. cpp: Fix an errant argument to a debug statement
David Reiss [Wed, 6 Oct 2010 17:10:11 +0000 (17:10 +0000)] 
THRIFT-926. cpp: Fix an errant argument to a debug statement

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005141 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Add profiling code to help conversion to C++ templates
David Reiss [Wed, 6 Oct 2010 17:10:10 +0000 (17:10 +0000)] 
THRIFT-922. cpp: Add profiling code to help conversion to C++ templates

Add some profiling code to track when potentially unnecessary virtual
calls are made in the thrift C++ serialization and deserialization code.
This can be used to help service implementors determine which places in
their code should be updated to use an appropriate thrift template
class.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005140 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: Thrift Server Client Stats
David Reiss [Wed, 6 Oct 2010 17:10:08 +0000 (17:10 +0000)] 
THRIFT-928. cpp: Thrift Server Client Stats

Add the ability for Thrift servers to monitor client connections.  It is
activated by #including server/TClientInfo.h and creating 1) a
TClientInfoCallHandler passed to the processor with setEventHandler()
and 2) a TClientInforServerHandler passed to the server with
setServerEventHandler().

The result vector, showing active connections, provides client address
and the thrift call it is executing (or last executed), the time
connected, and the number of calls made since connection.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005139 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Update C++ generator to emit templatized code
David Reiss [Wed, 6 Oct 2010 17:10:00 +0000 (17:10 +0000)] 
THRIFT-922. cpp: Update C++ generator to emit templatized code

When the "templates" option is passed to the C++ generator, it now emits
templatized versions of the client and processor.  Generated types emit
templatized read() and write() functions.

This allows the generated code to invoke the correct non-virtual
TTransport and TProtocol implementations, resulting in faster
serialization and deserialization.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005138 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Fix C++ compilation when using list<bool>
David Reiss [Wed, 6 Oct 2010 17:09:58 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Fix C++ compilation when using list<bool>

The STL specializes vector<bool> to store the values as individual bits, rather
than bools.  Therefore, when using a Thrift list<bool>, readBool() gets invoked
not with a bool&, but with a std::vector<bool>::reference.

TProtocol does provide a readBool(std::vector<bool>::reference) implementation.
However, almost all TProtocol subclasses defined only readBool(bool&), which
hides the other overloaded versions of readBool().  As a result, the code
worked only when accessing TProtocol objects via a "TProtocol*", and not
directly via the subclass type.  When using C++ templates, protocol objects do
get invoked via pointers to the subclass type, causing compile failures when
std::vector<bool> is used.

This change updates the various TProtocol implementations to also provide
readBool(std::vector<bool>::reference).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005137 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Templatize binary and compact protocol
David Reiss [Wed, 6 Oct 2010 17:09:56 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Templatize binary and compact protocol

Convert TBinaryProtocol and TCompactProtocol to template classes, taking
the transport class as a template parameter.  This allows them to make
non-virtual calls when using the template, improving serialization
performance.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005136 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Convert protocol classes to use non-virtual functions
David Reiss [Wed, 6 Oct 2010 17:09:52 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Convert protocol classes to use non-virtual functions

Updated the thrift protocol classes to use non-virtual calls for most
functions.  The correct implementation is determined at compile time via
templates now.  Only the base TProtocol class falls back to using
virtual function calls.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005135 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Convert transport classes to use non-virtual calls
David Reiss [Wed, 6 Oct 2010 17:09:50 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Convert transport classes to use non-virtual calls

Update the thrift transport classes to use non-virtual calls for most
functions.  The correct implementation is determined at compile time via
templates now.  Only the base TTransport class falls back to using
virtual function calls.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005134 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Add shortcutted version of readAll() in TBufferBase
David Reiss [Wed, 6 Oct 2010 17:09:47 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Add shortcutted version of readAll() in TBufferBase

Just perform a memcpy() if all of the requested data is available in the
buffer.  This improves performance a little in the common case.  It has
a bigger impact with the upcoming template changes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005133 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: When reading strings, borrow first
David Reiss [Wed, 6 Oct 2010 17:09:46 +0000 (17:09 +0000)] 
THRIFT-922. cpp: When reading strings, borrow first

Attempt to get a pointer to the internal transport buffer before copying
onto the heap.  This improves performance TFramedTransport and
TMemoryBuffer, and with TBufferedTransport if the string fits within the
buffer.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005132 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-923. cpp: Add completion notification to async clients
David Reiss [Wed, 6 Oct 2010 17:09:45 +0000 (17:09 +0000)] 
THRIFT-923. cpp: Add completion notification to async clients

Add a virtual function "completed__(bool)" to xxxCobClient that is
called by recv_xxx() after reception of a response (arg = true) or an
exception (arg = false). This allows the TAsyncClient to intercede at
that point, permitting, e.g., the load-balancing of persistent
connections that would otherwise remain bound to a single server.

A new "no_client_completion" flag inhibits generation of this mechanism.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005131 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: Prefix function name with service name
David Reiss [Wed, 6 Oct 2010 17:09:43 +0000 (17:09 +0000)] 
THRIFT-928. cpp: Prefix function name with service name

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005130 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: Include request/response size in processor callbacks
David Reiss [Wed, 6 Oct 2010 17:09:42 +0000 (17:09 +0000)] 
THRIFT-928. cpp: Include request/response size in processor callbacks

Required updating transport interface.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005129 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: Make clients call writeEnd on their transports before flush
David Reiss [Wed, 6 Oct 2010 17:09:39 +0000 (17:09 +0000)] 
THRIFT-928. cpp: Make clients call writeEnd on their transports before flush

Changing the order of these calls makes more sense from the perspective
of logical operations.  It also simplifies the upcoming stats collection
code.  No clients should be affected.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005128 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-923. cpp: Implement a fully nonblocking server and client
David Reiss [Wed, 6 Oct 2010 17:09:37 +0000 (17:09 +0000)] 
THRIFT-923. cpp: Implement a fully nonblocking server and client

There are three major parts of this:
1/ New callback-style interfaces for for a few key Thrift components:
   TAsyncProcessor for servers and TAsyncChannel for clients.
2/ Concrete implementations of TAsyncChannel and a server for
   TAsyncProcessor based on evhttp.
3/ Async-style code generation for C++

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005127 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-928. cpp: Processor-level event callbacks
David Reiss [Wed, 6 Oct 2010 17:09:33 +0000 (17:09 +0000)] 
THRIFT-928. cpp: Processor-level event callbacks

- Add a TProcessorEventHandler callback interface.
- Add methods to TProcessor to hold an instance of the interface.
- Add code to the compiler to make the processor call callbacks at key points.
- Add an optional processor event handler to the test server.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005126 13f79535-47bb-0310-9956-ffa450edef68

14 years agoTHRIFT-922. cpp: Revert the BufferBase part of r750585
David Reiss [Wed, 6 Oct 2010 17:09:31 +0000 (17:09 +0000)] 
THRIFT-922. cpp: Revert the BufferBase part of r750585

r750585 included two logically distinct changes, one of which was not
referenced in the commit message and was not reviewed by a C++
maintainer.  It was committed more-or-less by accident.  This patch
reverts that part of the change since it conflicts with the template
code in some complicated ways.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005125 13f79535-47bb-0310-9956-ffa450edef68