Opened 11 years ago

Closed 11 years ago

#5999 closed Bugs (fixed)

boost::asio::async_read with completion_condition strange behavior when the given buffer is exausted before the completion function returned true

Reported by: bugspynet@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

Consider

asio::async_read(tcpSocket, inBuf,completionFn, handlerFn);

Where inBuf was set to a max size N.

Now if the completionFn won't return true for the next N bytes received, asio strangely just calls handlerFn without the error_code set. There is no way for the code to know that something went wrong (the buffer exausted before completionFn returned true)

Expected behavior:

Call the completionFn or handlerFn with error_code set.

Actual behavior:

handlerFn is called without setting the error_code.

Change History (2)

comment:1 by chris_kohlhoff, 11 years ago

(In [74952]) Clarify that the read operation ends when the buffer is full. Refs #5999

comment:2 by chris_kohlhoff, 11 years ago

Resolution: fixed
Status: newclosed

(In [75009]) Merge from trunk:

  • Make number of strand implementations configurable by defining BOOST_ASIO_STRAND_IMPLEMENTATIONS to the number.
  • Programs can now define BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION to switch the allocation of strand implementations to use a round-robin approach rather than hashing.
  • Fix potential strand starvation issue that can occur when strand.post() is used.
  • Update descriptor state allocation in kqueue_reactor to match approach used in epoll_reactor.
  • Construct epoll_reactor's interrupter member first to fix exception safety issue. Fixes #6006
  • Clarify that the read operation ends when the buffer is full. Fixes #5999
Note: See TracTickets for help on using tickets.