static void rpc_group_callback( error_code err, dsn_message_t req, dsn_message_t resp, task_resp_queue* q, rpc_reply_handler action_on_succeed, rpc_reply_handler action_on_failure) { if (ERR_OK == err) { action_on_succeed(err, req, resp); } else { action_on_failure(err, req, resp); dsn::rpc_address group_addr = ((dsn::message_ex*)req)->server_address; dsn_group_forward_leader(group_addr.group_handle()); auto req_again = dsn_msg_copy(req); auto call_again = ::dsn::rpc::call( group_addr, req_again, nullptr, [=](error_code err, dsn_message_t request, dsn_message_t response) { rpc_group_callback(err, request, response, q, std::move(action_on_succeed), std::move(action_on_failure)); } ); q->enqueue(call_again, 0); } }
static void rpc_group_callback( error_code err, dsn_message_t req, dsn_message_t resp, task_resp_queue* q, rpc_reply_handler action_on_succeed, rpc_reply_handler action_on_failure) { if (ERR_OK == err) { action_on_succeed(err, req, resp); } else { action_on_failure(err, req, resp); dsn::rpc_address group_addr = ((dsn::message_ex*)req)->server_address; dsn_group_forward_leader(group_addr.group_handle()); auto req_again = dsn_msg_copy(req); dsn::task_ptr call_again = ::dsn::rpc::call(group_addr, req_again, nullptr, std::bind(&rpc_group_callback, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, q, action_on_succeed, action_on_failure)); q->enqueue(call_again, 0); } }