File 85738.patch of Package boost.3258
Source: https://svn.boost.org/trac/boost/changeset/85738
Summary: Fix regression from Boost 1.53
Bug: bnc#925309
Fix a regression where, on some platforms, errors from async_connect are not
correctly propagated through to the completion handler.
Index: /trunk/boost/asio/detail/impl/socket_ops.ipp
===================================================================
--- /trunk/boost/asio/detail/impl/socket_ops.ipp (revision 84349)
+++ /trunk/boost/asio/detail/impl/socket_ops.ipp (revision 85738)
@@ -510,11 +510,34 @@
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.