common/thrift.git
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

14 years agoTHRIFT-945. java: TAsyncClient class's currentMethod is never set, hence a second...
Bryan Duxbury [Wed, 6 Oct 2010 00:28:10 +0000 (00:28 +0000)] 
THRIFT-945. java: TAsyncClient class's currentMethod is never set, hence a second call on the same client will fail if a previous call is ongoing.

This patch adds a test for the problem and fixes the issue by setting the current method after a call has been started.

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

14 years agoTHRIFT-941. php: Make PHP C Extension use the defined Protocol writeMessageBegin...
Bryan Duxbury [Wed, 6 Oct 2010 00:23:30 +0000 (00:23 +0000)] 
THRIFT-941. php:  Make PHP C Extension use the defined Protocol writeMessageBegin function

This patch causes the C extension to call into user-land to get the correct writeMessageBegin function.

Patch: Chris Goffinet

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

14 years agoTHRIFT-932. hs: Haskell tests need to be run through 'make check' (and probably ...
Bryan Duxbury [Wed, 6 Oct 2010 00:12:33 +0000 (00:12 +0000)] 
THRIFT-932. hs: Haskell tests need to be run through 'make check' (and probably 'cabal check') too

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

14 years agoTHRIFT-944. hs: Support all version-4s of base
Bryan Duxbury [Wed, 6 Oct 2010 00:01:43 +0000 (00:01 +0000)] 
THRIFT-944. hs: Support all version-4s of base

Patch: Christian Lavoie

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

14 years agoTHRIFT-933 : looks fine, and cabal check looks good as well
Anthony F. Molinaro [Tue, 5 Oct 2010 17:08:08 +0000 (17:08 +0000)] 
THRIFT-933 : looks fine, and cabal check looks good as well

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

14 years agoTHRIFT-943: fix typo
Anthony F. Molinaro [Tue, 5 Oct 2010 16:47:52 +0000 (16:47 +0000)] 
THRIFT-943: fix typo

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

14 years agodisable php extension if php-config is missing
Anthony F. Molinaro [Tue, 5 Oct 2010 16:45:50 +0000 (16:45 +0000)] 
disable php extension if php-config is missing

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

14 years agoTHRIFT-868. Make const values work properly with typdefs
David Reiss [Tue, 5 Oct 2010 16:39:29 +0000 (16:39 +0000)] 
THRIFT-868. Make const values work properly with typdefs

Just requires calling get_true_type in the right spot.  Because "the
right spot" is under src/parse, get_true_type had to be moed from
t_generator to t_type.

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

14 years agocompiler: Move t_type::generate_fingerprint to a .cc file
David Reiss [Tue, 5 Oct 2010 16:39:27 +0000 (16:39 +0000)] 
compiler: Move t_type::generate_fingerprint to a .cc file

Forcing all of the functions under src/parse to be defined in header
files is silly and sometimes painful.  Createa a "parse.cc" file for
functions that don't belong in header files.  To start, move
generate_fingerprint there, because it requires including md5.h.

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

14 years agoerlang: Use Automake SUBDIRS instead of a manual forwarding rule
David Reiss [Tue, 5 Oct 2010 02:38:59 +0000 (02:38 +0000)] 
erlang: Use Automake SUBDIRS instead of a manual forwarding rule

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

14 years agoTHRIFT-841. Exclude generated php and erlang Makefiles from "make dist"
David Reiss [Tue, 5 Oct 2010 02:38:58 +0000 (02:38 +0000)] 
THRIFT-841. Exclude generated php and erlang Makefiles from "make dist"

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

14 years agoTHRIFT-940 use BOOST_LDFLAGS for unit tests, required to build on Mac OS X
Roger Meier [Mon, 4 Oct 2010 21:13:36 +0000 (21:13 +0000)] 
THRIFT-940 use BOOST_LDFLAGS for unit tests, required to build on Mac OS X

Patch: Christian Lavoie

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

14 years agoTHRIFT-939. java: optional binary fields throw NPE on default byte[] getters
Bryan Duxbury [Thu, 30 Sep 2010 19:36:05 +0000 (19:36 +0000)] 
THRIFT-939. java: optional binary fields throw NPE on default byte[] getters

This patch deals with null ByteBuffers correctly.

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

14 years agobump versions to 0.6.0
Bryan Duxbury [Tue, 28 Sep 2010 17:44:45 +0000 (17:44 +0000)] 
bump versions to 0.6.0

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

14 years agoupdate the CHANGES file
Bryan Duxbury [Tue, 28 Sep 2010 15:06:38 +0000 (15:06 +0000)] 
update the CHANGES file

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

14 years agoTHRIFT-900. cpp: Unix domain socket
Bryan Duxbury [Tue, 28 Sep 2010 14:36:07 +0000 (14:36 +0000)] 
THRIFT-900. cpp: Unix domain socket

This patch adds a new Unix Socket transport.

Patch: Roger Meier

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

14 years agocontrib/fb303: use pure_enums in C++ for compatibility
David Reiss [Tue, 28 Sep 2010 03:30:17 +0000 (03:30 +0000)] 
contrib/fb303: use pure_enums in C++ for compatibility

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

14 years agoTHRIFT-912. java: Fix some bugs in SASL implementation, update protocol spec slightly
Todd Lipcon [Tue, 28 Sep 2010 00:11:01 +0000 (00:11 +0000)] 
THRIFT-912. java: Fix some bugs in SASL implementation, update protocol spec slightly

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

14 years agoTHRIFT-931. java: Add log4j.properties missing from previous commit
Todd Lipcon [Tue, 28 Sep 2010 00:02:53 +0000 (00:02 +0000)] 
THRIFT-931. java: Add log4j.properties missing from previous commit

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

14 years agoTHRIFT-890. java: Add README missing from previous commit
Todd Lipcon [Tue, 28 Sep 2010 00:01:31 +0000 (00:01 +0000)] 
THRIFT-890. java: Add README missing from previous commit

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

14 years agoTHRIFT-931. java: Use log4j for Java tests
Todd Lipcon [Mon, 27 Sep 2010 23:51:22 +0000 (23:51 +0000)] 
THRIFT-931. java: Use log4j for Java tests

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

14 years agoTHRIFT-787. compiler: Enums are not read correctly
Bryan Duxbury [Mon, 27 Sep 2010 23:37:44 +0000 (23:37 +0000)] 
THRIFT-787. compiler: Enums are not read correctly

This patch removes unnecessary enum value resolution code from all the individual generators. It's been unnecessary since forever ago when we made the compiler force the global resolution of values.

Patch: Christian Lavoie

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

14 years agoTHRIFT-918 : better haskell tests
Anthony F. Molinaro [Mon, 27 Sep 2010 19:27:40 +0000 (19:27 +0000)] 
THRIFT-918 : better haskell tests

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

14 years agoTHRIFT-890. java: Fix tutorial to build and run in trunk
Todd Lipcon [Mon, 27 Sep 2010 18:26:07 +0000 (18:26 +0000)] 
THRIFT-890. java: Fix tutorial to build and run in trunk

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

14 years agoTHRIFT-919 : updated haskell README
Anthony F. Molinaro [Mon, 27 Sep 2010 17:33:47 +0000 (17:33 +0000)] 
THRIFT-919 : updated haskell README

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

14 years agoTHRIFT-335. python: Initial implementation of TCompactProtocol
David Reiss [Mon, 27 Sep 2010 17:28:15 +0000 (17:28 +0000)] 
THRIFT-335. python: Initial implementation of TCompactProtocol

Seems to work.  No interoperability testing with other languages yet.

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

14 years agoTHRIFT-920. cpp: C++ Test and Tutorial does not compile anymore due to the change...
Bryan Duxbury [Mon, 27 Sep 2010 17:26:02 +0000 (17:26 +0000)] 
THRIFT-920. cpp: C++ Test and Tutorial does not compile anymore due to the change within Enum handling

Patch: Roger Meier and Christian Lavoie

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

14 years agoTHRIFT-905: hook haskell into autoconf
Anthony F. Molinaro [Mon, 27 Sep 2010 17:22:17 +0000 (17:22 +0000)] 
THRIFT-905: hook haskell into autoconf

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

14 years agoTHRIFT-917. java: THsHaServer should not accept an ExecutorService without catching...
Bryan Duxbury [Mon, 27 Sep 2010 17:12:36 +0000 (17:12 +0000)] 
THRIFT-917. java: THsHaServer should not accept an ExecutorService without catching RejectedExecutionException

This patch catches RejectedExecutionException from requestInvoke and closes the client connection when that occurs.

Patch: Ed Ceaser

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

14 years agomake check wasn't working because python namespace was incorrect
Anthony F. Molinaro [Mon, 27 Sep 2010 04:43:39 +0000 (04:43 +0000)] 
make check wasn't working because python namespace was incorrect

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

14 years agoTHRIFT-743: seems to compile and doesn't break other tests, so seems fine for now
Anthony F. Molinaro [Sun, 26 Sep 2010 04:25:36 +0000 (04:25 +0000)] 
THRIFT-743: seems to compile and doesn't break other tests, so seems fine for now

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

14 years agoignore generated artifacts
Anthony F. Molinaro [Sun, 26 Sep 2010 04:22:24 +0000 (04:22 +0000)] 
ignore generated artifacts

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

14 years agoignore generated directory
Anthony F. Molinaro [Sun, 26 Sep 2010 04:21:08 +0000 (04:21 +0000)] 
ignore generated directory

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

14 years agoignore test artifacts
Anthony F. Molinaro [Sun, 26 Sep 2010 04:20:23 +0000 (04:20 +0000)] 
ignore test artifacts

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

14 years agoTHRIFT-881. csharp: add csharp to the tutorial
Bryan Duxbury [Fri, 24 Sep 2010 16:47:59 +0000 (16:47 +0000)] 
THRIFT-881. csharp: add csharp to the tutorial

This patch adds a tutorial for CSharp. It also moves the 'test' client and server into the tutorial, because they were not being used by the tests.

Patch: Roger Meier

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

14 years agoTHRIFT-914 : haskell bindings compile easier
Anthony F. Molinaro [Thu, 23 Sep 2010 22:28:09 +0000 (22:28 +0000)] 
THRIFT-914 : haskell bindings compile easier

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

14 years agoTHRIFT-911: fix for trailing commas in sets, lists, maps, consts
T Jake Luciani [Wed, 22 Sep 2010 02:33:06 +0000 (02:33 +0000)] 
THRIFT-911: fix for trailing commas in sets, lists, maps, consts

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

14 years agoTHRIFT-906. hs: Improve type mappings
Bryan Duxbury [Wed, 22 Sep 2010 00:48:56 +0000 (00:48 +0000)] 
THRIFT-906. hs: Improve type mappings

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

14 years agoTHRIFT-910. Update .gitignore
David Reiss [Tue, 21 Sep 2010 18:35:43 +0000 (18:35 +0000)] 
THRIFT-910. Update .gitignore

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

14 years agoTHRIFT-907. java: update fb303 to compile on trunk
Todd Lipcon [Tue, 21 Sep 2010 18:01:43 +0000 (18:01 +0000)] 
THRIFT-907. java: update fb303 to compile on trunk

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

14 years agoTHRIFT-909. rb: allow block argument to struct constructor
Bryan Duxbury [Tue, 21 Sep 2010 16:30:58 +0000 (16:30 +0000)] 
THRIFT-909. rb: allow block argument to struct constructor

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

14 years agoTHRIFT-880. javame: JavaME code generator and runtime library
Bryan Duxbury [Mon, 20 Sep 2010 17:49:09 +0000 (17:49 +0000)] 
THRIFT-880. javame: JavaME code generator and runtime library

This patch adds a new generator and library that produces code suitable for use in JavaME environments.

Patch: David Engberg

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

14 years agoTHRIFT-901. hs: Allow the bindings to compile without -fglasgow-exts and with -Wall...
Bryan Duxbury [Mon, 20 Sep 2010 17:41:40 +0000 (17:41 +0000)] 
THRIFT-901. hs: Allow the bindings to compile without -fglasgow-exts and with -Wall -Werror

Forgot a small chunk of the previous patch.

Patch: Christian Lavoie

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

14 years agoTHRIFT-901. hs: Allow the bindings to compile without -fglasgow-exts and with -Wall...
Bryan Duxbury [Mon, 20 Sep 2010 15:21:37 +0000 (15:21 +0000)] 
THRIFT-901. hs: Allow the bindings to compile without -fglasgow-exts and with -Wall -Werror

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

14 years agoTHRIFT-323. csharp: TJSONProtocol
Bryan Duxbury [Sat, 18 Sep 2010 20:51:25 +0000 (20:51 +0000)] 
THRIFT-323. csharp: TJSONProtocol

This patch adds support for the JSON Protocol to the csharp library.

Patch: Roger Meier

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

14 years agoTHRIFT-885: fix string encoding
T Jake Luciani [Fri, 17 Sep 2010 23:38:25 +0000 (23:38 +0000)] 
THRIFT-885: fix string encoding

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

14 years agoTHRIFT-899. rb: Ruby read timeouts can sometimes be 2x what they should be
Bryan Duxbury [Fri, 17 Sep 2010 20:17:21 +0000 (20:17 +0000)] 
THRIFT-899. rb: Ruby read timeouts can sometimes be 2x what they should be

This patch makes sure that we don't wait longer than necessary for timeouts.

Patch: Ryan King

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

14 years agoTHRIFT-882. java: deep copy of binary fields does not copy ByteBuffer characteristics...
Bryan Duxbury [Fri, 17 Sep 2010 19:27:36 +0000 (19:27 +0000)] 
THRIFT-882. java: deep copy of binary fields does not copy ByteBuffer characteristics (arrayOffset, position)

This patch ensures that binary fields are copied correctly.

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

14 years agoFix enum value lookups in C++
David Reiss [Mon, 13 Sep 2010 17:32:14 +0000 (17:32 +0000)] 
Fix enum value lookups in C++

The recent enum change was causing enums to break if used as constant
values by the C++ generator.  The problem was that we were searching for
the fully-qualified constant name (enum_name.VALUE_NAME) in the enum
values.  This didn't affect Java because it just uses symbolic names in
the generated code.  Fix it by grabbing the base name before doing the
search.

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

14 years agoDon't segfault if t_enum::get_constant_by_name fails
David Reiss [Mon, 13 Sep 2010 17:32:13 +0000 (17:32 +0000)] 
Don't segfault if t_enum::get_constant_by_name fails

The recent enum change was causing t_enum::get_constant_by_name to fail
in t_const_value::get_integer.  This was causing a difficult-to-debug
segfault.  Check for failure and throw an exeception.

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

14 years agoTHRIFT-870. java: Java constants don't get Javadoc comments
Bryan Duxbury [Mon, 13 Sep 2010 16:28:53 +0000 (16:28 +0000)] 
THRIFT-870. java: Java constants don't get Javadoc comments

Fix a trivial oversight.

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

14 years agoTHRIFT-894. java: Make default accessors for binary fields return byte[]; provide...
Bryan Duxbury [Mon, 13 Sep 2010 15:42:36 +0000 (15:42 +0000)] 
THRIFT-894. java: Make default accessors for binary fields return byte[]; provide new accessors to get ByteBuffer version

This patch causes the underlying ByteBuffer that backs a binary field to be hidden behind a default accessor that provides a byte[] interface. This should allow users who skipped 0.4 to update their generated code without breaking any of their other code. A new accessor has been added that allows a way down to the underlying ByteBuffer for those experts who want to take advantage.

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

14 years agojava: tiny improvement to async client manager test, for real this time
Bryan Duxbury [Sun, 12 Sep 2010 15:31:50 +0000 (15:31 +0000)] 
java: tiny improvement to async client manager test, for real this time

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

14 years agojava: tiny improvement to async client manager test
Bryan Duxbury [Sun, 12 Sep 2010 15:30:06 +0000 (15:30 +0000)] 
java: tiny improvement to async client manager test

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

14 years agoTHRIFT-897. compiler: Don't allow unqualified enum constant access
Bryan Duxbury [Sun, 12 Sep 2010 15:29:38 +0000 (15:29 +0000)] 
THRIFT-897. compiler: Don't allow unqualified enum constant access

Fix some confusion in the java generator about adding the class name.

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

14 years agoTHRIFT-897. compiler: Don't allow unqualified enum constant references
Bryan Duxbury [Sun, 12 Sep 2010 15:22:49 +0000 (15:22 +0000)] 
THRIFT-897. compiler: Don't allow unqualified enum constant references

Missed a spot.

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

14 years agoTHRIFT-897. compiler: Don't allow unqualified enum constant references
Bryan Duxbury [Sun, 12 Sep 2010 15:22:21 +0000 (15:22 +0000)] 
THRIFT-897. compiler: Don't allow unqualified enum constant references

Missed a spot.

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

14 years agoTHRIFT-897. compiler: Don't allow unqualified constant access to enum values
Bryan Duxbury [Sun, 12 Sep 2010 14:38:36 +0000 (14:38 +0000)] 
THRIFT-897. compiler: Don't allow unqualified constant access to enum values

This patch makes it illegal to refer to enum values by just their names in the IDL. Now, you must also provide the enum type's name as well.

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

14 years agoTHRIFT-895. cpp: By default, generate enums as class-scoped enums
David Reiss [Fri, 10 Sep 2010 23:00:40 +0000 (23:00 +0000)] 
THRIFT-895. cpp: By default, generate enums as class-scoped enums

Most of the other Thrift languages either have enum values that are
scoped to the type or emulate enums in that way.  Now C++ does the same
by default.  "enum Foo" in a .thrift file will be generated as Foo::type
so the values can be called Foo::value1, etc.  The "pure_enums" compiler
option restores the old behavior.

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

14 years agoTHRIFT-896. java: TNonblockingSocket.isOpen() returns true even after close()
Bryan Duxbury [Fri, 10 Sep 2010 19:08:00 +0000 (19:08 +0000)] 
THRIFT-896. java: TNonblockingSocket.isOpen() returns true even after close()

This patch makes TNonblockingSocket.isOpen() have more expected behavior.

Patch: Eric Jensen

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