WiredRdTask start_internal()

in src/cpp/RiderLink/Source/RD/src/rd_framework_cpp/src/main/task/RdCall.h [111:140]


	WiredRdTask<TRes, ResSer> start_internal(TReq const& request, bool sync, IScheduler* scheduler) const
	{
		assert_bound();
		if (!async)
		{
			assert_threading();
		}

		RdId task_id = get_protocol()->get_identity()->next(rdid);
		WiredRdTask<TRes, ResSer> task{*bind_lifetime, *this, task_id, scheduler};

		if (sync)
		{
			if (sync_task_id.has_value())
			{
				throw std::invalid_argument(
					"Already exists sync task for call " + to_string(location) + ", taskId = " + rd::to_string(*sync_task_id));
			}
			sync_task_id = task_id;
		}

		get_wire()->send(rdid, [&](Buffer& buffer) {
			spdlog::get("logSend")->trace("call {}::{} send {} request {} : {}", to_string(location), to_string(rdid), (sync ? "SYNC" : "ASYNC"),
				to_string(task_id), to_string(request));
			task_id.write(buffer);
			ReqSer::write(get_serialization_context(), buffer, request);
		});

		return task;
	}