size_t write_some( AsyncWriteStream& s, const ConstBufferSequence& buf ) { detail::non_blocking<AsyncWriteStream> non_blocking; if( non_blocking(s) || non_blocking(s,true) ) { boost::system::error_code ec; size_t r = s.write_some( buf, ec ); if( !ec ) return r; if( ec != boost::asio::error::would_block) { BOOST_THROW_EXCEPTION( boost::system::system_error(ec) ); } } promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some")); s.async_write_some( buf, boost::bind( detail::read_write_handler, p, _1, _2 ) ); return p->wait(); }
void async_write_some(AsyncWriteStream& s, const std::shared_ptr<const char>& buffer, size_t length, size_t offset, promise<size_t>::ptr completion_promise) { s.async_write_some(boost::asio::buffer(buffer.get() + offset, length), detail::read_write_handler_with_buffer(completion_promise, buffer)); }
void async_write_some(AsyncWriteStream& s, const char* buffer, size_t length, promise<size_t>::ptr completion_promise) { s.async_write_some(boost::asio::buffer(buffer, length), detail::read_write_handler(completion_promise)); }
void async_write_some(AsyncWriteStream& s, const ConstBufferSequence& buf, promise<size_t>::ptr completion_promise) { s.async_write_some(buf, detail::read_write_handler(completion_promise)); }
future<size_t> write_some( AsyncWriteStream& s, const std::shared_ptr<const char>& buffer, size_t length, size_t offset ) { promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some")); s.async_write_some( boost::asio::buffer(buffer.get() + offset, length), detail::read_write_handler_with_buffer(p, buffer)); return p; //->wait(); }
future<size_t> write_some( AsyncWriteStream& s, const char* buffer, size_t length, size_t offset = 0) { promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some")); s.async_write_some( boost::asio::buffer(buffer + offset, length), detail::read_write_handler(p)); return p; //->wait(); }
future<size_t> write_some( AsyncWriteStream& s, const ConstBufferSequence& buf ) { promise<size_t>::ptr p(new promise<size_t>("fc::asio::write_some")); s.async_write_some( buf, detail::read_write_handler(p)); return p; //->wait(); }