diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
commit | 3c1df2168531ad5580076ae08d529054689aeedd (patch) | |
tree | 941aff6f86393eecacddfec252a8508c7e8351c9 /boost/asio/ssl/detail/io.hpp | |
parent | d6a306e745acfee00e81ccaf3324a2a03516db41 (diff) | |
download | boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.gz boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.bz2 boost-3c1df2168531ad5580076ae08d529054689aeedd.zip |
Imported Upstream version 1.70.0upstream/1.70.0
Diffstat (limited to 'boost/asio/ssl/detail/io.hpp')
-rw-r--r-- | boost/asio/ssl/detail/io.hpp | 17 |
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); |