Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85738 - trunk/boost/asio/detail/impl
From: chris_at_[hidden]
Date: 2013-09-17 17:35:43


Author: chris_kohlhoff
Date: 2013-09-17 17:35:43 EDT (Tue, 17 Sep 2013)
New Revision: 85738
URL: http://svn.boost.org/trac/boost/changeset/85738

Log:
Fix a regression where, on some platforms, errors from async_connect are not
correctly propagated through to the completion handler.

Text files modified:
   trunk/boost/asio/detail/impl/socket_ops.ipp | 29 ++++++++++++++++++++++++++---
   1 files changed, 26 insertions(+), 3 deletions(-)

Modified: trunk/boost/asio/detail/impl/socket_ops.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/socket_ops.ipp Tue Sep 17 17:33:39 2013 (r85737)
+++ trunk/boost/asio/detail/impl/socket_ops.ipp 2013-09-17 17:35:43 EDT (Tue, 17 Sep 2013) (r85738)
@@ -509,13 +509,36 @@
 }
 
 bool non_blocking_connect(socket_type s,
- const socket_addr_type* addr, std::size_t addrlen,
+ const socket_addr_type*, std::size_t,
     boost::system::error_code& ec)
 {
   // Check if the connect operation has finished. This is required since we may
   // get spurious readiness notifications from the reactor.
- socket_ops::connect(s, addr, addrlen, ec);
- if (ec == boost::asio::error::already_started)
+#if defined(BOOST_ASIO_WINDOWS) \
+ || defined(__CYGWIN__) \
+ || defined(__SYMBIAN32__)
+ fd_set write_fds;
+ FD_ZERO(&write_fds);
+ FD_SET(s, &write_fds);
+ fd_set except_fds;
+ FD_ZERO(&except_fds);
+ FD_SET(s, &except_fds);
+ timeval zero_timeout;
+ zero_timeout.tv_sec = 0;
+ zero_timeout.tv_usec = 0;
+ int ready = ::select(s + 1, 0, &write_fds, &except_fds, &zero_timeout);
+#else // defined(BOOST_ASIO_WINDOWS)
+ // || defined(__CYGWIN__)
+ // || defined(__SYMBIAN32__)
+ pollfd fds;
+ fds.fd = s;
+ fds.events = POLLOUT;
+ fds.revents = 0;
+ int ready = ::poll(&fds, 1, 0);
+#endif // defined(BOOST_ASIO_WINDOWS)
+ // || defined(__CYGWIN__)
+ // || defined(__SYMBIAN32__)
+ if (ready == 0)
   {
     // The asynchronous connect operation is still in progress.
     return false;


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