]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/ssl/detail/impl/engine.ipp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / asio / ssl / detail / impl / engine.ipp
index 9142a5df3a397a1dbddd07be62617d288f79d1c9..cac7dfda5655373a9b9f4aa375481a2e0ae82201 100644 (file)
@@ -2,7 +2,7 @@
 // ssl/detail/impl/engine.ipp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -241,14 +241,23 @@ engine::want engine::perform(int (engine::* op)(void*, std::size_t),
   {
     ec = boost::system::error_code(sys_error,
         boost::asio::error::get_ssl_category());
-    return want_nothing;
+    return pending_output_after > pending_output_before
+      ? want_output : want_nothing;
   }
 
   if (ssl_error == SSL_ERROR_SYSCALL)
   {
-    ec = boost::system::error_code(sys_error,
-        boost::asio::error::get_system_category());
-    return want_nothing;
+    if (sys_error == 0)
+    {
+      ec = boost::asio::ssl::error::unspecified_system_error;
+    }
+    else
+    {
+      ec = boost::system::error_code(sys_error,
+          boost::asio::error::get_ssl_category());
+    }
+    return pending_output_after > pending_output_before
+      ? want_output : want_nothing;
   }
 
   if (result > 0 && bytes_transferred)
@@ -269,16 +278,21 @@ engine::want engine::perform(int (engine::* op)(void*, std::size_t),
     ec = boost::system::error_code();
     return want_input_and_retry;
   }
-  else if (::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN)
+  else if (ssl_error == SSL_ERROR_ZERO_RETURN)
   {
     ec = boost::asio::error::eof;
     return want_nothing;
   }
-  else
+  else if (ssl_error == SSL_ERROR_NONE)
   {
     ec = boost::system::error_code();
     return want_nothing;
   }
+  else
+  {
+    ec = boost::asio::ssl::error::unexpected_result;
+    return want_nothing;
+  }
 }
 
 int engine::do_accept(void*, std::size_t)