-static void dccp_send(long unsigned current_chunk,
- __a_unused long unsigned chunks_sent, const char *buf, size_t len)
-{
- struct dccp_client *dc, *tmp;
- int ret;
- char *header_buf;
-
- if (listen_fd < 0 || !len)
- return;
-
- list_for_each_entry_safe(dc, tmp, &clients, node) {
- if (!dc->header_sent && current_chunk) {
- size_t header_len;
- header_buf = vss_get_header(&header_len);
- if (header_buf && header_len > 0) {
- if (queue_chunk_or_shutdown(dc, -1U, 0) < 0)
- continue;
- }
- dc->header_sent = 1;
- }
- ret = send_queued_chunks(dc);
- if (ret < 0) {
- dccp_shutdown_client(dc);
- continue;
- }
-// PARA_DEBUG_LOG("writing %d bytes to fd %d\n", len, dc->fd);
- ret = dccp_write(dc->fd, buf, len);
- if (ret < 0) {
- PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
- dccp_shutdown_client(dc);
- continue;
- }
- if (ret != len)
- queue_chunk_or_shutdown(dc, current_chunk, ret);
- }
-}