diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp index ad828aa..61f676b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp @@ -2,7 +2,7 @@ // reactive_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2010 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) @@ -348,16 +348,23 @@ public: boost::asio::buffer_size(buffer)); } - // Write the data. - int bytes = descriptor_ops::gather_write(descriptor_, bufs, i, ec); + for (;;) + { + // Write the data. + int bytes = descriptor_ops::gather_write(descriptor_, bufs, i, ec); - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, @@ -600,18 +607,25 @@ public: boost::asio::buffer_size(buffer)); } - // Read some data. - int bytes = descriptor_ops::scatter_read(descriptor_, bufs, i, ec); - if (bytes == 0) - ec = boost::asio::error::eof; + for (;;) + { + // Read some data. + int bytes = descriptor_ops::scatter_read(descriptor_, bufs, i, ec); + if (bytes == 0) + ec = boost::asio::error::eof; - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - return false; + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; - bytes_transferred = (bytes < 0 ? 0 : bytes); - return true; + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + bytes_transferred = (bytes < 0 ? 0 : bytes); + return true; + } } void complete(const boost::system::error_code& ec, |