Lines Matching refs:ctx

128   struct cw_out_ctx *ctx = writer->ctx;  in cw_out_init()  local
130 ctx->buf = NULL; in cw_out_init()
134 static void cw_out_bufs_free(struct cw_out_ctx *ctx) in cw_out_bufs_free() argument
136 while(ctx->buf) { in cw_out_bufs_free()
137 struct cw_out_buf *next = ctx->buf->next; in cw_out_bufs_free()
138 cw_out_buf_free(ctx->buf); in cw_out_bufs_free()
139 ctx->buf = next; in cw_out_bufs_free()
143 static size_t cw_out_bufs_len(struct cw_out_ctx *ctx) in cw_out_bufs_len() argument
145 struct cw_out_buf *cwbuf = ctx->buf; in cw_out_bufs_len()
156 struct cw_out_ctx *ctx = writer->ctx; in cw_out_close() local
159 cw_out_bufs_free(ctx); in cw_out_close()
194 static CURLcode cw_out_ptr_flush(struct cw_out_ctx *ctx, in cw_out_ptr_flush() argument
207 if(ctx->errored) in cw_out_ptr_flush()
218 while(blen && !ctx->paused) { in cw_out_ptr_flush()
238 ctx->paused = TRUE; in cw_out_ptr_flush()
258 static CURLcode cw_out_buf_flush(struct cw_out_ctx *ctx, in cw_out_buf_flush() argument
268 result = cw_out_ptr_flush(ctx, data, cwbuf->type, flush_all, in cw_out_buf_flush()
290 static CURLcode cw_out_flush_chain(struct cw_out_ctx *ctx, in cw_out_flush_chain() argument
300 if(ctx->paused) in cw_out_flush_chain()
308 result = cw_out_flush_chain(ctx, data, plast, flush_all); in cw_out_flush_chain()
313 DEBUGASSERT(ctx->paused); in cw_out_flush_chain()
318 result = cw_out_buf_flush(ctx, data, cwbuf, flush_all); in cw_out_flush_chain()
328 static CURLcode cw_out_append(struct cw_out_ctx *ctx, in cw_out_append() argument
332 if(cw_out_bufs_len(ctx) + blen > DYN_PAUSE_BUFFER) in cw_out_append()
338 if(!ctx->buf || (ctx->buf->type != otype) || (otype == CW_OUT_HDS)) { in cw_out_append()
342 cwbuf->next = ctx->buf; in cw_out_append()
343 ctx->buf = cwbuf; in cw_out_append()
345 DEBUGASSERT(ctx->buf && (ctx->buf->type == otype)); in cw_out_append()
346 return Curl_dyn_addn(&ctx->buf->b, buf, blen); in cw_out_append()
349 static CURLcode cw_out_do_write(struct cw_out_ctx *ctx, in cw_out_do_write() argument
359 if(ctx->buf && ctx->buf->type != otype) { in cw_out_do_write()
360 result = cw_out_flush_chain(ctx, data, &ctx->buf, TRUE); in cw_out_do_write()
365 if(ctx->buf) { in cw_out_do_write()
367 result = cw_out_append(ctx, otype, buf, blen); in cw_out_do_write()
370 result = cw_out_flush_chain(ctx, data, &ctx->buf, flush_all); in cw_out_do_write()
377 result = cw_out_ptr_flush(ctx, data, otype, flush_all, in cw_out_do_write()
383 result = cw_out_append(ctx, otype, buf + consumed, blen - consumed); in cw_out_do_write()
393 ctx->errored = TRUE; in cw_out_do_write()
394 cw_out_bufs_free(ctx); in cw_out_do_write()
403 struct cw_out_ctx *ctx = writer->ctx; in cw_out_write() local
409 result = cw_out_do_write(ctx, data, CW_OUT_BODY, flush_all, buf, blen); in cw_out_write()
415 result = cw_out_do_write(ctx, data, CW_OUT_HDS, flush_all, buf, blen); in cw_out_write()
426 struct cw_out_ctx *ctx; in Curl_cw_out_is_paused() local
432 ctx = (struct cw_out_ctx *)cw_out; in Curl_cw_out_is_paused()
433 CURL_TRC_WRITE(data, "cw-out is%spaused", ctx->paused ? "" : " not"); in Curl_cw_out_is_paused()
434 return ctx->paused; in Curl_cw_out_is_paused()
445 struct cw_out_ctx *ctx = (struct cw_out_ctx *)cw_out; in cw_out_flush() local
446 if(ctx->errored) in cw_out_flush()
448 if(unpause && ctx->paused) in cw_out_flush()
449 ctx->paused = FALSE; in cw_out_flush()
450 if(ctx->paused) in cw_out_flush()
453 result = cw_out_flush_chain(ctx, data, &ctx->buf, flush_all); in cw_out_flush()
455 ctx->errored = TRUE; in cw_out_flush()
456 cw_out_bufs_free(ctx); in cw_out_flush()