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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
- 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
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
Tests are now self-contained and correctly exit after running. There's a single run script which has improved error messages and defaults to the thrift binary compiled in the current source directory instead of those in PATH. And as a bonus hooks both cabal check and running the tests to make check.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004861 13f79535-47bb-0310-9956-ffa450edef68
Previously, lib/erl/Makefile.am would forward rules like "all" and
"clean" to the src subdir by manually invoking a submake. However,
specifying src as a SUBDIR accomplishes this more easily and also
ensures that other rules like "distclean" work.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004510 13f79535-47bb-0310-9956-ffa450edef68
This patch fixes the type mappings to be more sane. It *will* break existing code, but the breakages should be well worth it.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@999700 13f79535-47bb-0310-9956-ffa450edef68
This patch allows the user to pass a block to generated structs' constructors. The block will receive and instance of the new object.
Patch: Michael Stockton
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@999487 13f79535-47bb-0310-9956-ffa450edef68
This patch makes the bindings compile with pedantic warning levels, and individually declares each required language extension.
Patch: Christian Lavoie
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@998955 13f79535-47bb-0310-9956-ffa450edef68