Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66613 - in trunk: boost/asio/detail boost/asio/detail/impl libs/asio/doc
From: chris_at_[hidden]
Date: 2010-11-16 08:17:08


Author: chris_kohlhoff
Date: 2010-11-16 08:16:45 EST (Tue, 16 Nov 2010)
New Revision: 66613
URL: http://svn.boost.org/trac/boost/changeset/66613

Log:
Fixed a Windows-specific problem where failures from accept() are incorrectly treated as successes. Refs #4859.

Text files modified:
   trunk/boost/asio/detail/impl/socket_ops.ipp | 4 ++--
   trunk/boost/asio/detail/reactive_socket_service.hpp | 2 +-
   trunk/libs/asio/doc/history.qbk | 3 +++
   3 files changed, 6 insertions(+), 3 deletions(-)

Modified: trunk/boost/asio/detail/impl/socket_ops.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/socket_ops.ipp (original)
+++ trunk/boost/asio/detail/impl/socket_ops.ipp 2010-11-16 08:16:45 EST (Tue, 16 Nov 2010)
@@ -119,7 +119,7 @@
     socket_type new_socket = socket_ops::accept(s, addr, addrlen, ec);
 
     // Check if operation succeeded.
- if (new_socket >= 0)
+ if (new_socket != invalid_socket)
       return new_socket;
 
     // Operation failed.
@@ -210,7 +210,7 @@
     new_socket = socket_ops::accept(s, addr, addrlen, ec);
 
     // Check if operation succeeded.
- if (new_socket >= 0)
+ if (new_socket != invalid_socket)
       return true;
 
     // Retry operation if interrupted by signal.

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 2010-11-16 08:16:45 EST (Tue, 16 Nov 2010)
@@ -326,7 +326,7 @@
           peer_endpoint ? &addr_len : 0, ec));
 
     // On success, assign new connection to peer socket object.
- if (new_socket.get() >= 0)
+ if (new_socket.get() != invalid_socket)
     {
       if (peer_endpoint)
         peer_endpoint->resize(addr_len);

Modified: trunk/libs/asio/doc/history.qbk
==============================================================================
--- trunk/libs/asio/doc/history.qbk (original)
+++ trunk/libs/asio/doc/history.qbk 2010-11-16 08:16:45 EST (Tue, 16 Nov 2010)
@@ -48,6 +48,9 @@
   ([@https://svn.boost.org/trac/boost/ticket/4662 #4662]).
 * Fixed the socket `io_control()` implementation on 64-bit Mac OS X and BSD
   platforms ([@https://svn.boost.org/trac/boost/ticket/4782 #4782]).
+* Fixed a Windows-specific problem where failures from `accept()` are
+ incorrectly treated as successes
+ ([@https://svn.boost.org/trac/boost/ticket/4859 #4859]).
 * Deprecated the separate compilation header `<boost/asio/impl/src.cpp>` in
   favour of `<boost/asio/impl/src.hpp>`
   ([@https://svn.boost.org/trac/boost/ticket/4560 #4560]).


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