Lines Matching defs:tcreq

645 	struct test_client_request *tcreq;
647 tcreq = i_new(struct test_client_request, 1);
648 DLLIST_PREPEND(&client_requests, tcreq);
650 return tcreq;
654 test_client_request_destroy(struct test_client_request *tcreq)
656 io_remove(&tcreq->io);
657 i_stream_unref(&tcreq->payload);
658 i_stream_unref(&tcreq->file);
660 DLLIST_REMOVE(&client_requests, tcreq);
661 i_free(tcreq);
667 struct test_client_request *tcreq;
671 for (tcreq = client_requests; tcreq != NULL;
672 tcreq = tcreq->next) {
673 if (tcreq->io != NULL)
674 tcreq->io = io_loop_move_io(&tcreq->io);
675 if (tcreq->payload != NULL)
676 i_stream_switch_ioloop(tcreq->payload);
734 test_client_download_payload_input(struct test_client_request *tcreq)
736 struct istream *payload = tcreq->payload;
739 unsigned int files_idx = tcreq->files_idx;
749 tcreq->files_idx, (int)psize);
754 (tcreq->file, &fdata, &fsize)) > 0 && pleft > 0) {
760 payload->v_offset, tcreq->file->v_offset);
762 i_stream_skip(tcreq->file, fsize);
766 if (ret < 0 && tcreq->file->stream_errno != 0) {
768 "failed to read file: %s", i_stream_get_error(tcreq->file));
777 tcreq->files_idx);
781 (void)i_stream_read(tcreq->file);
786 } if (i_stream_have_bytes_left(tcreq->file)) {
787 if (i_stream_read_more(tcreq->file, &fdata, &fsize) <= 0)
795 tcreq->files_idx);
799 tcreq->payload = NULL;
800 io_remove(&tcreq->io); /* holds a reference too */
810 struct test_client_request *tcreq)
821 tcreq->files_idx);
827 i_assert(tcreq->files_idx < count);
829 path = paths[tcreq->files_idx];
835 tcreq->files_idx, path);
854 test_client_download_finished(tcreq->files_idx);
862 path, tcreq->files_idx);
865 test_client_download_finished(tcreq->files_idx);
872 tcreq->payload = resp->payload;
873 tcreq->file = fstream;
876 tcreq->payload = i_stream_create_limit
878 tcreq->file = i_stream_create_limit
883 tcreq->io = io_add_istream(tcreq->payload,
884 test_client_download_payload_input, tcreq);
885 test_client_download_payload_input(tcreq);
890 struct test_client_request *tcreq;
921 tcreq = test_client_request_new();
922 tcreq->files_idx = client_files_last;
927 path, tcreq->files_idx);
929 hreq = tcreq->hreq = http_client_request(http_client,
932 test_client_download_response, tcreq);
935 test_client_request_destroy, tcreq);
971 test_client_echo_payload_input(struct test_client_request *tcreq)
973 struct istream *payload = tcreq->payload;
976 unsigned int files_idx = tcreq->files_idx;
986 tcreq->files_idx, (int)psize);
991 (tcreq->file, &fdata, &fsize)) > 0 && pleft > 0) {
997 payload->v_offset, tcreq->file->v_offset);
999 i_stream_skip(tcreq->file, fsize);
1003 if (ret < 0 && tcreq->file->stream_errno != 0) {
1005 "failed to read file: %s", i_stream_get_error(tcreq->file));
1014 tcreq->files_idx);
1018 (void)i_stream_read(tcreq->file);
1023 } if (i_stream_have_bytes_left(tcreq->file)) {
1024 if (i_stream_read_more(tcreq->file, &fdata, &fsize) <= 0)
1032 tcreq->files_idx);
1036 tcreq->payload = NULL;
1037 io_remove(&tcreq->io); /* holds a reference too */
1047 struct test_client_request *tcreq)
1057 tcreq->files_idx);
1063 i_assert(tcreq->files_idx < count);
1065 path = paths[tcreq->files_idx];
1071 tcreq->files_idx, path);
1098 path, tcreq->files_idx);
1101 test_client_echo_finished(tcreq->files_idx);
1106 tcreq->file = fstream;
1109 tcreq->payload = resp->payload;
1110 tcreq->io = io_add_istream(resp->payload,
1111 test_client_echo_payload_input, tcreq);
1112 test_client_echo_payload_input(tcreq);
1117 struct test_client_request *tcreq;
1175 tcreq = test_client_request_new();
1176 tcreq->files_idx = client_files_last;
1178 hreq = tcreq->hreq = http_client_request(http_client,
1181 test_client_echo_response, tcreq);
1186 test_client_request_destroy, tcreq);