- list_for_each_entry_safe(hc, tmp, &clients, node) {
- if (hc->status != HTTP_STREAMING &&
- hc->status != HTTP_READY_TO_STREAM)
- continue;
- if (hc->status == HTTP_READY_TO_STREAM) {
- size_t hlen;
- char *hbuf = vss_get_header(&hlen);
- if (hbuf && hlen > 0 && current_chunk) {
- /* need to send header */
- PARA_INFO_LOG("queueing header: %zu\n", hlen);
- if (queue_chunk_or_shutdown(hc, -1U, 0) < 0)
- continue;
- } else
- PARA_INFO_LOG("no need to queue header\n");
- hc->status = HTTP_STREAMING;
- }
- ret = send_queued_chunks(hc);
- if (ret < 0) {
- http_shutdown_client(hc, "queue send error");
- continue;
- }
- if (!len)
- continue;
- if (!ret || write_ok(hc->fd) <= 0) {
- queue_chunk_or_shutdown(hc, current_chunk, 0);
- continue;
- }
-// PARA_DEBUG_LOG("sending %d -> %s\n", len, remote_name(hc->fd));
- ret = write(hc->fd, buf, len);
-// PARA_DEBUG_LOG("ret: %d\n", ret);
- if (ret < 0) {
- http_shutdown_client(hc, "send error");
- continue;
- }
- if (ret != len)
- queue_chunk_or_shutdown(hc, current_chunk, ret);
+ list_for_each_entry_safe(sc, tmp, &hss->client_list, node) {
+ struct private_http_sender_data *phsd = sc->private_data;
+
+ if (phsd->status == HTTP_STREAMING)
+ http_send_chunk(sc, hss, current_chunk, buf, len,
+ header_buf, header_len);