]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/detail/impl/socket_select_interrupter.ipp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / asio / detail / impl / socket_select_interrupter.ipp
index e09c5fbeb0e08bbcfb67366c82e10e2c30912ecd..ef9c1c1659d44be9f189294294da96dcf8cf5972 100644 (file)
@@ -2,7 +2,7 @@
 // detail/impl/socket_select_interrupter.ipp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2020 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)
@@ -156,11 +156,20 @@ bool socket_select_interrupter::reset()
   socket_ops::buf b;
   socket_ops::init_buf(b, data, sizeof(data));
   boost::system::error_code ec;
-  int bytes_read = socket_ops::recv(read_descriptor_, &b, 1, 0, ec);
-  bool was_interrupted = (bytes_read > 0);
-  while (bytes_read == sizeof(data))
-    bytes_read = socket_ops::recv(read_descriptor_, &b, 1, 0, ec);
-  return was_interrupted;
+  for (;;)
+  {
+    int bytes_read = socket_ops::recv(read_descriptor_, &b, 1, 0, ec);
+    if (bytes_read == sizeof(data))
+      continue;
+    if (bytes_read > 0)
+      return true;
+    if (bytes_read == 0)
+      return false;
+    if (ec == boost::asio::error::would_block
+        || ec == boost::asio::error::try_again)
+      return true;
+    return false;
+  }
 }
 
 } // namespace detail