| 40 | template <typename SyncWriteStream, typename ConstBufferSequence, |
| 41 | typename ConstBufferIterator, typename CompletionCondition> |
| 42 | std::size_t write(SyncWriteStream& s, |
| 43 | const ConstBufferSequence& buffers, const ConstBufferIterator&, |
| 44 | CompletionCondition completion_condition, asio::error_code& ec) |
| 45 | { |
| 46 | ec = asio::error_code(); |
| 47 | asio::detail::consuming_buffers<const_buffer, |
| 48 | ConstBufferSequence, ConstBufferIterator> tmp(buffers); |
| 49 | while (!tmp.empty()) |
| 50 | { |
| 51 | if (std::size_t max_size = detail::adapt_completion_condition_result( |
| 52 | completion_condition(ec, tmp.total_consumed()))) |
| 53 | tmp.consume(s.write_some(tmp.prepare(max_size), ec)); |
| 54 | else |
| 55 | break; |
| 56 | } |
| 57 | return tmp.total_consumed(); |
| 58 | } |
| 59 | } // namespace detail |
| 60 | |
| 61 | template <typename SyncWriteStream, typename ConstBufferSequence, |