void uh_chunk_vprintf(struct client *cl, const char *format, va_list arg) { char buf[256]; va_list arg2; int len; if (cl->state == CLIENT_STATE_CLEANUP) return; uloop_timeout_set(&cl->timeout, conf.network_timeout * 1000); if (!uh_use_chunked(cl)) { ustream_vprintf(cl->us, format, arg); return; } va_copy(arg2, arg); len = vsnprintf(buf, sizeof(buf), format, arg2); va_end(arg2); ustream_printf(cl->us, "%X\r\n", len); if (len < sizeof(buf)) ustream_write(cl->us, buf, len, true); else ustream_vprintf(cl->us, format, arg); ustream_printf(cl->us, "\r\n", len); }
int u_tcp_printf(const char *format, ...) { va_list arg; int ret; if (usfd.stream.write_error) return -1; va_start(arg, format); ret = ustream_vprintf(&usfd.stream, format, arg); va_end(arg); return ret; }
int ustream_printf(struct ustream *s, const char *format, ...) { va_list arg; int ret; if (s->write_error) return 0; va_start(arg, format); ret = ustream_vprintf(s, format, arg); va_end(arg); return ret; }