void t3_notify(struct curl_client_t* cc, void* args) { struct task_step_t* ts = (struct task_step_t*)(args); struct task_step_result_t* rt = NULL; struct task_step_t* t1 = NULL; t1_data_t* td = NULL; if (curl_client_err_code(cc) != CURLE_OK) { printf("task step[%x] asynchronous notify, fail\n", task_step_id(ts)); rt = task_step_result_init(TASK_RET_FAIL); task_step_finish(ts, rt); task_step_result_release(rt); } printf("task step[%x] asynchronous notify, complete\n", task_step_id(ts)); t1 = task_get_step(task_step_task(ts), id); assert(t1); td = (t1_data_t*)task_step_data(t1); td->result --; if (td->result > 0) { printf("need to loop %d times\n", td->result); rt = task_step_result_init(TASK_RET_NEXT); task_step_result_set_backward(rt); task_step_finish(ts, rt); task_step_result_release(rt); } else { rt = task_step_result_init(TASK_RET_SUCCESS); task_step_finish(ts, rt); task_step_result_release(rt); } }
static void t3_notify(curlc_t* cc, void* args) { task_step_t* ts = (struct task_step_t*)(args); if (curlc_ret(cc) != CURLE_OK) { printf("task step[%x] asynchronous notify, fail\n", task_step_id(ts)); task_step_resume(ts, TASK_RET_FAIL, 0); } printf("task step[%x] asynchronous notify, complete\n", task_step_id(ts)); task_step_t* t1 = task_get_step(task_step_task(ts), _task_step_id); if (!t1) { fprintf(stderr, "task get step fail"); return; } t1_param_t* tsp = (t1_param_t*)task_step_param(t1); if (tsp->loop -- > 0) { printf("need to loop %d times\n", tsp->loop); task_step_resume(ts, TASK_RET_NEXT, -1); } else { task_step_resume(ts, TASK_RET_SUCCESS, 0); } }