summaryrefslogtreecommitdiff
path: root/boost/asio/ssl/detail/io.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/ssl/detail/io.hpp')
-rw-r--r--boost/asio/ssl/detail/io.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/boost/asio/ssl/detail/io.hpp b/boost/asio/ssl/detail/io.hpp
index 604148c795..f1c2e5317a 100644
--- a/boost/asio/ssl/detail/io.hpp
+++ b/boost/asio/ssl/detail/io.hpp
@@ -2,7 +2,7 @@
// ssl/detail/io.hpp
// ~~~~~~~~~~~~~~~~~
//
-// 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)
@@ -32,6 +32,7 @@ template <typename Stream, typename Operation>
std::size_t io(Stream& next_layer, stream_core& core,
const Operation& op, boost::system::error_code& ec)
{
+ boost::system::error_code io_ec;
std::size_t bytes_transferred = 0;
do switch (op(core.engine_, ec, bytes_transferred))
{
@@ -40,8 +41,12 @@ std::size_t io(Stream& next_layer, stream_core& core,
// If the input buffer is empty then we need to read some more data from
// the underlying transport.
if (core.input_.size() == 0)
+ {
core.input_ = boost::asio::buffer(core.input_buffer_,
- next_layer.read_some(core.input_buffer_, ec));
+ next_layer.read_some(core.input_buffer_, io_ec));
+ if (!ec)
+ ec = io_ec;
+ }
// Pass the new input data to the engine.
core.input_ = core.engine_.put_input(core.input_);
@@ -54,7 +59,9 @@ std::size_t io(Stream& next_layer, stream_core& core,
// Get output data from the engine and write it to the underlying
// transport.
boost::asio::write(next_layer,
- core.engine_.get_output(core.output_buffer_), ec);
+ core.engine_.get_output(core.output_buffer_), io_ec);
+ if (!ec)
+ ec = io_ec;
// Try the operation again.
continue;
@@ -64,7 +71,9 @@ std::size_t io(Stream& next_layer, stream_core& core,
// Get output data from the engine and write it to the underlying
// transport.
boost::asio::write(next_layer,
- core.engine_.get_output(core.output_buffer_), ec);
+ core.engine_.get_output(core.output_buffer_), io_ec);
+ if (!ec)
+ ec = io_ec;
// Operation is complete. Return result to caller.
core.engine_.map_error_code(ec);