示例#1
0
		void async_write(SyncWriteStreamT &s, const ConstBufferT &buf, const ComplateConditionT &condition, const HandlerT &handler)
		{
			typedef detail::write_handler_t<SyncWriteStreamT, ConstBufferT, ComplateConditionT, HandlerT> HookWriteHandler;

			std::uint32_t send_len = detail::MAX_BUFFER_LEN > buf.size() ? buf.size() : detail::MAX_BUFFER_LEN;
			s.async_write(buffer(buf.data(), send_len), HookWriteHandler(s, buf, buf.size(), condition, 0, handler));
		}
示例#2
0
	void async_write(SyncWriteStreamT &s, const ConstBufferT &buf, const ComplateConditionT &condition, HandlerT &&handler, const AllocatorT &allocator)
	{
		typedef details::write_handler_t<SyncWriteStreamT, ConstBufferT, ComplateConditionT, HandlerT, AllocatorT> HookWriteHandler;

		HookWriteHandler hook_handler(s, buf, buf.size(), condition, 0, std::forward<HandlerT>(handler), allocator);
		s.async_write(hook_handler.buffer_, std::move(hook_handler), allocator);
	}
示例#3
0
		std::uint32_t write(SyncWriteStreamT &s, const ConstBufferT &buffer, const CompleteConditionT &condition, const rw_callback_type &callback)
		{
			std::uint32_t transfers = 0;
			const std::uint32_t bufSize = buffer.size();

			while( transfers < condition(transfers) )
			{
				if( transfers >= bufSize )
					break;

				std::uint32_t ret = s.write(buffer + transfers);
				if( ret == 0 )
				{
					s.close();
				}


				transfers += ret;

				if( callback != 0 )
					callback(win32_error_2_error_code(::GetLastError()), transfers);
			}

			return transfers;
		}
示例#4
0
	std::uint32_t write(SyncWriteStreamT &s, const ConstBufferT &buffer, const std::uint64_t &offset, const CompleteConditionT &condition)
	{
		std::uint32_t transfers = 0;
		const std::uint32_t bufSize = buffer.size();

		while( transfers <= condition(transfers) )
		{
			if( transfers >= bufSize )
				break;

			std::uint32_t ret = s.write(buffer + transfers, offset);
			if( ret == 0 )
			{
				s.close();
			}

			transfers += ret;
		}

		return transfers;
	}
示例#5
0
	std::uint32_t write(SyncWriteStreamT &s, const ConstBufferT &buffer, const CompleteConditionT &condition, const HandlerT &callback)
	{
		std::uint32_t transfers = 0;
		const std::uint32_t bufSize = buffer.size();

		while( transfers < condition(transfers) )
		{
			if( transfers >= bufSize )
				break;

			auto ret = s.write(buffer + transfers);
			if( ret == 0 )
			{
				throw service::win32_exception_t("s.write");
			}

			transfers += (std::uint32_t)ret;

			callback(std::make_error_code((std::errc)::GetLastError()), transfers);
		}

		return transfers;
	}
示例#6
0
			size_t Write(const ConstBufferT &buffer, const u_int64 &offset)
			{
				return impl_->Write(buffer.data(), buffer.size(), offset);
			}
示例#7
0
			size_t Write(const ConstBufferT &buffer)
			{
				return impl_->Write(buffer.data(), buffer.size(), 0);
			}
示例#8
0
			void AsyncWrite(const ConstBufferT &buffer, const u_int64 &offset, const HandlerT &callback)
			{
				return impl_->AsyncWrite(buffer.data(), buffer.size(), offset, callback);
			}
示例#9
0
	void async_write(SyncWriteStreamT &s, const ConstBufferT &buffer, const std::uint64_t &offset, const ComplateConditionT &condition, HandlerT &&handler)
	{
		typedef details::write_offset_handler_t<SyncWriteStreamT, ConstBufferT, ComplateConditionT, HandlerT> HookWriteHandler;

		s.async_write(buffer, offset, HookWriteHandler(s, buffer, buffer.size(), offset, condition, 0, std::forward<HandlerT>(handler)));
	}
示例#10
0
		void async_write(SyncWriteStreamT &s, const ConstBufferT &buffer, const u_int64 &offset, const ComplateConditionT &condition, const HandlerT &handler)
		{
			typedef detail::write_offset_handler_t<SyncWriteStreamT, ConstBufferT, ComplateConditionT, HandlerT> HookWriteHandler;

			s.async_write(buffer, offset, HookWriteHandler(s, buffer, buffer.size(), offset, condition, 0, handler));
		}