/[Apache-SVN]
ViewVC logotype

Revision 1005161


Jump to revision: Previous Next
Author: dreiss
Date: Wed Oct 6 17:10:40 2010 UTC (14 years, 1 month ago)
Changed paths: 6
Log Message:
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.

Changed paths

Path Details
Directoryincubator/thrift/trunk/lib/cpp/src/transport/TBufferTransports.cpp modified , text changed
Directoryincubator/thrift/trunk/lib/cpp/src/transport/TBufferTransports.h modified , text changed
Directoryincubator/thrift/trunk/lib/cpp/src/transport/TFDTransport.cpp modified , text changed
Directoryincubator/thrift/trunk/lib/cpp/src/transport/TZlibTransport.cpp modified , text changed
Directoryincubator/thrift/trunk/lib/cpp/test/TransportTest.cpp modified , text changed
Directoryincubator/thrift/trunk/lib/cpp/test/ZlibTest.cpp modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26