Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52294 - in trunk: boost/asio/detail libs/asio/test/archetypes libs/asio/test/ip
From: chris_at_[hidden]
Date: 2009-04-09 08:16:03


Author: chris_kohlhoff
Date: 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
New Revision: 52294
URL: http://svn.boost.org/trac/boost/changeset/52294

Log:
Fix implementation of io_control() so that it adheres to the type
requirements for IoControlCommand. Fixes #2820.

Added:
   trunk/libs/asio/test/archetypes/
   trunk/libs/asio/test/archetypes/io_control_command.hpp (contents, props changed)
Text files modified:
   trunk/boost/asio/detail/reactive_socket_service.hpp | 2 +-
   trunk/boost/asio/detail/win_iocp_socket_service.hpp | 4 +++-
   trunk/libs/asio/test/ip/tcp.cpp | 3 ++-
   trunk/libs/asio/test/ip/udp.cpp | 3 ++-
   4 files changed, 8 insertions(+), 4 deletions(-)

Modified: trunk/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_socket_service.hpp 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
@@ -448,7 +448,7 @@
       // Flags are manipulated in a temporary variable so that the socket
       // implementation is not updated unless the ioctl operation succeeds.
       unsigned char new_flags = impl.flags_;
- if (command.get())
+ if (*static_cast<ioctl_arg_type*>(command.data()))
         new_flags |= implementation_type::user_set_non_blocking;
       else
         new_flags &= ~implementation_type::user_set_non_blocking;

Modified: trunk/boost/asio/detail/win_iocp_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_socket_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_socket_service.hpp 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
@@ -573,7 +573,7 @@
 
     if (!ec && command.name() == static_cast<int>(FIONBIO))
     {
- if (command.get())
+ if (*static_cast<ioctl_arg_type*>(command.data()))
         impl.flags_ |= implementation_type::user_set_non_blocking;
       else
         impl.flags_ &= ~implementation_type::user_set_non_blocking;
@@ -2192,6 +2192,8 @@
     bool perform(boost::system::error_code& ec,
         std::size_t& bytes_transferred)
     {
+ bytes_transferred = 0;
+
       // Check whether the operation was successful.
       if (ec)
         return true;

Added: trunk/libs/asio/test/archetypes/io_control_command.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/archetypes/io_control_command.hpp 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
@@ -0,0 +1,32 @@
+//
+// io_control_command.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef ARCHETYPES_IO_CONTROL_COMMAND_HPP
+#define ARCHETYPES_IO_CONTROL_COMMAND_HPP
+
+namespace archetypes {
+
+class io_control_command
+{
+public:
+ int name() const
+ {
+ return 0;
+ }
+
+ void* data()
+ {
+ return 0;
+ }
+};
+
+} // namespace archetypes
+
+#endif // ARCHETYPES_IO_CONTROL_COMMAND_HPP

Modified: trunk/libs/asio/test/ip/tcp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/tcp.cpp (original)
+++ trunk/libs/asio/test/ip/tcp.cpp 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
@@ -20,6 +20,7 @@
 #include <cstring>
 #include <boost/asio.hpp>
 #include "../unit_test.hpp"
+#include "../archetypes/io_control_command.hpp"
 
 //------------------------------------------------------------------------------
 
@@ -149,7 +150,7 @@
     const char const_char_buffer[128] = "";
     socket_base::message_flags in_flags = 0;
     socket_base::keep_alive socket_option;
- socket_base::bytes_readable io_control_command;
+ archetypes::io_control_command io_control_command;
     boost::system::error_code ec;
 
     // basic_stream_socket constructors.

Modified: trunk/libs/asio/test/ip/udp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/udp.cpp (original)
+++ trunk/libs/asio/test/ip/udp.cpp 2009-04-09 08:16:02 EDT (Thu, 09 Apr 2009)
@@ -20,6 +20,7 @@
 #include <cstring>
 #include <boost/asio.hpp>
 #include "../unit_test.hpp"
+#include "../archetypes/io_control_command.hpp"
 
 //------------------------------------------------------------------------------
 
@@ -54,7 +55,7 @@
     const char const_char_buffer[128] = "";
     socket_base::message_flags in_flags = 0;
     socket_base::keep_alive socket_option;
- socket_base::bytes_readable io_control_command;
+ archetypes::io_control_command io_control_command;
     boost::system::error_code ec;
 
     // basic_datagram_socket constructors.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk