Subject: [Boost-bugs] [Boost C++ Libraries] #4170: Error using null_buffers in async_send_to in Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-29 22:45:15
#4170: Error using null_buffers in async_send_to in Windows
-------------------------------------+--------------------------------------
Reporter: nythil@⦠| Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: asio
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+--------------------------------------
While exploring the boost.asio library I came across a bug caused by a
typo in one of the header files. When async_send_to is invoked on an UDP
socket with null_buffers, the following sequence of calls takes place:
1. {{{basic_datagram_socket->async_send_to(const ConstBufferSequence&
buffers, const endpoint_type& destination, WriteHandler handler)}}}
2. {{{datagram_socket_service->async_send_to(implementation_type& impl,
const ConstBufferSequence& buffers, const endpoint_type& destination,
socket_base::message_flags flags, WriteHandler handler)}}}
3. {{{win_iocp_socket_service->async_send_to(implementation_type& impl,
const ConstBufferSequence& buffers, const endpoint_type& destination,
socket_base::message_flags flags, Handler handler)}}}
The problem is, the 3rd function is the generic version of async_send_to()
which expects a valid buffer. Passing null_buffers causes an error.
There is also a specialization of async_send_to() for the null_buffers
case. Unfortunately, it's never called, because in the declaration some
arguments are out of place. The declaration is:
{{{async_send_to(implementation_type& impl, const null_buffers&,
socket_base::message_flags, const endpoint_type&, Handler handler)}}}.
Compared to the generic version, the {{{flags}}} and {{{destination}}}
arguments are swapped. After correcting the order of these two arguments,
async_send_to() works as expected.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4170> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC