Lines Matching refs:t
180 struct transfer *t = userdata; in my_write_cb() local
185 t->idx, (long)blen, (long)t->recv_size, (long)t->pause_at); in my_write_cb()
186 if(!t->out) { in my_write_cb()
187 curl_msnprintf(t->filename, sizeof(t->filename)-1, "download_%u.data", in my_write_cb()
188 t->idx); in my_write_cb()
189 t->out = fopen(t->filename, "wb"); in my_write_cb()
190 if(!t->out) in my_write_cb()
194 nwritten = fwrite(buf, nitems, buflen, t->out); in my_write_cb()
196 fprintf(stderr, "[t-%d] write failure\n", t->idx); in my_write_cb()
199 t->recv_size += (curl_off_t)nwritten; in my_write_cb()
206 struct transfer *t = userdata; in my_read_cb() local
210 if(t->send_total <= t->send_size) in my_read_cb()
212 else if((t->send_total - t->send_size) < (curl_off_t)blen) in my_read_cb()
213 nread = (size_t)(t->send_total - t->send_size); in my_read_cb()
218 t->idx, (long)nread, (long)t->send_total, (long)t->pause_at); in my_read_cb()
220 if(!t->resumed && in my_read_cb()
221 t->send_size < t->pause_at && in my_read_cb()
222 ((t->send_size + (curl_off_t)blen) >= t->pause_at)) { in my_read_cb()
223 fprintf(stderr, "[t-%d] PAUSE\n", t->idx); in my_read_cb()
224 t->paused = 1; in my_read_cb()
229 t->send_size += (curl_off_t)nread; in my_read_cb()
230 if(t->fail_at > 0 && t->send_size >= t->fail_at) { in my_read_cb()
232 t->idx, (long)t->send_size); in my_read_cb()
242 struct transfer *t = userdata; in my_progress_cb() local
246 if(t->abort_at > 0 && ulnow >= t->abort_at) { in my_progress_cb()
248 t->idx, (long)ulnow); in my_progress_cb()
254 static int setup(CURL *hnd, const char *url, struct transfer *t, in setup() argument
265 curl_easy_setopt(hnd, CURLOPT_WRITEDATA, t); in setup()
269 if(!t->method || !strcmp("PUT", t->method)) in setup()
271 else if(!strcmp("POST", t->method)) in setup()
274 fprintf(stderr, "unsupported method '%s'\n", t->method); in setup()
278 curl_easy_setopt(hnd, CURLOPT_READDATA, t); in setup()
280 curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, t->send_total); in setup()
284 curl_easy_setopt(hnd, CURLOPT_XFERINFODATA, t); in setup()
345 struct transfer *t; in main() local
453 t = &transfers[i]; in main()
454 t->idx = (int)i; in main()
455 t->method = method; in main()
456 t->send_total = (curl_off_t)send_total; in main()
457 t->abort_at = (curl_off_t)abort_offset; in main()
458 t->fail_at = (curl_off_t)fail_offset; in main()
459 t->pause_at = (curl_off_t)pause_offset; in main()
470 t = &transfers[i]; in main()
471 t->easy = easy; in main()
472 if(setup(t->easy, url, t, http_version, host, share, use_earlydata, in main()
478 fprintf(stderr, "[t-%d] STARTING\n", t->idx); in main()
480 fprintf(stderr, "[t-%d] DONE -> %d\n", t->idx, rc); in main()
481 t->easy = NULL; in main()
492 t = &transfers[i]; in main()
493 t->easy = curl_easy_init(); in main()
494 if(!t->easy || setup(t->easy, url, t, http_version, host, share, in main()
499 curl_multi_add_handle(multi_handle, t->easy); in main()
500 t->started = 1; in main()
502 fprintf(stderr, "[t-%d] STARTED\n", t->idx); in main()
524 t = get_transfer_for_easy(e); in main()
525 if(t) { in main()
526 t->done = 1; in main()
527 fprintf(stderr, "[t-%d] FINISHED\n", t->idx); in main()
531 fprintf(stderr, "[t-%d] EarlyData: %ld\n", t->idx, (long)sent); in main()
545 t = &transfers[i]; in main()
546 if(!t->done && t->paused && t->easy) { in main()
547 curl_multi_remove_handle(multi_handle, t->easy); in main()
548 t->done = 1; in main()
550 fprintf(stderr, "[t-%d] ABORTED\n", t->idx); in main()
557 t = &transfers[i]; in main()
558 if(!t->done && t->paused) { in main()
559 t->resumed = 1; in main()
560 t->paused = 0; in main()
561 curl_easy_pause(t->easy, CURLPAUSE_CONT); in main()
562 fprintf(stderr, "[t-%d] RESUMED\n", t->idx); in main()
570 t = &transfers[i]; in main()
571 if(!t->started) { in main()
572 t->easy = curl_easy_init(); in main()
573 if(!t->easy || setup(t->easy, url, t, http_version, host, in main()
578 curl_multi_add_handle(multi_handle, t->easy); in main()
579 t->started = 1; in main()
581 fprintf(stderr, "[t-%d] STARTED\n", t->idx); in main()
597 t = &transfers[i]; in main()
598 if(t->out) { in main()
599 fclose(t->out); in main()
600 t->out = NULL; in main()
602 if(t->easy) { in main()
603 curl_easy_cleanup(t->easy); in main()
604 t->easy = NULL; in main()