| 764 | } |
| 765 | |
| 766 | void start_write() { |
| 767 | if (pending_write || !connected || !owner) |
| 768 | return; |
| 769 | if (outgoing_buffer.empty()) { |
| 770 | if (asked_shutdown) |
| 771 | start_shutdown(); |
| 772 | return; |
| 773 | } |
| 774 | pending_write = true; |
| 775 | boost::array<boost::asio::const_buffer, 2> bufs{ |
| 776 | {boost::asio::buffer(outgoing_buffer.read_ptr(), outgoing_buffer.read_count()), |
| 777 | boost::asio::buffer(outgoing_buffer.read_ptr2(), outgoing_buffer.read_count2())}}; |
| 778 | #if platform_USE_SSL |
| 779 | if (ssl_socket) |
| 780 | ssl_socket->async_write_some(bufs, std::bind(&Impl::handle_write, owner->impl, _1, _2)); |
| 781 | else |
| 782 | #endif |
| 783 | socket.async_write_some(bufs, std::bind(&Impl::handle_write, owner->impl, _1, _2)); |
| 784 | } |
| 785 | |
| 786 | void handle_write(const boost::system::error_code &e, std::size_t bytes_transferred) { |
| 787 | pending_write = false; |
no test coverage detected