- if (sc->cq != NULL) {
- /* ignore return value, closing the target anyway. */
- (void)write(sc->fd, buf, len);
- cq_destroy(sc->cq);
- sc->cq = NULL;
- }
+ if (ut->sent_fec_eof)
+ return;
+ PARA_NOTICE_LOG("sending FEC EOF\n");
+ len = vss_get_fec_eof_packet(&buf);
+ /* Ignore write() errors since we are closing the target anyway. */
+ if (write(sc->fd, buf, len))
+ do_nothing; /* avoid "ignoring return value" warning */
+ ut->sent_fec_eof = true;
-/** The maximal size of the per-target chunk queue. */
-#define UDP_CQ_BYTES 40000
-
-static void udp_init_session(struct sender_client *sc)
-{
- if (sc->cq == NULL) {
- sc->cq = cq_new(UDP_CQ_BYTES);
- PARA_NOTICE_LOG("sending to udp %s\n", sc->name);
- }
-}
-
static void udp_shutdown_targets(void)
{
struct sender_client *sc, *tmp;
static void udp_shutdown_targets(void)
{
struct sender_client *sc, *tmp;
/** Initialize UDP session and set maximum payload size. */
static int udp_init_fec(struct sender_client *sc)
{
/** Initialize UDP session and set maximum payload size. */
static int udp_init_fec(struct sender_client *sc)
{
mps = generic_max_transport_msg_size(sc->fd) - sizeof(struct udphdr);
PARA_INFO_LOG("current MPS = %d bytes\n", mps);
return mps;
mps = generic_max_transport_msg_size(sc->fd) - sizeof(struct udphdr);
PARA_INFO_LOG("current MPS = %d bytes\n", mps);
return mps;
- ret = send_queued_chunks(sc->fd, sc->cq);
- if (ret < 0)
- goto fail;
- if (!ret) { /* still data left in the queue */
- ret = cq_force_enqueue(sc->cq, buf, len);
- assert(ret >= 0);
- return 0;
- }
- ret = write_nonblock(sc->fd, buf, len);
+ ret = xwrite(sc->fd, buf, len);
if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) {
/*
* Happens if meanwhile an ICMP Destination / Port Unreachable
if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) {
/*
* Happens if meanwhile an ICMP Destination / Port Unreachable
ut->fcp.data_slices_per_group = scd->data_slices_per_group;
ut->fcp.init_fec = udp_init_fec;
ut->fcp.send_fec = udp_send_fec;
ut->fcp.data_slices_per_group = scd->data_slices_per_group;
ut->fcp.init_fec = udp_init_fec;
ut->fcp.send_fec = udp_send_fec;
- "udp sender:\n"
- "\tstatus: %s\n"
- "\tport: %s\n"
- "\ttargets: %s\n",
- (sender_status == SENDER_ON)? "on" : "off",
- stringify_port(conf.udp_default_port_arg, "udp"),
+ "status: %s\n"
+ "port: %s\n"
+ "targets: %s\n",
+ (sender_status == SENDER_on)? "on" : "off",
+ stringify_port(OPT_UINT32_VAL(UDP_DEFAULT_PORT), "udp"),
- for (i = 0; i < conf.udp_target_given; i++) {
- if (udp_resolve_target(conf.udp_target_arg[i], &scd) < 0)
+ for (i = 0; i < OPT_GIVEN(UDP_TARGET); i++) {
+ const char *arg = lls_string_val(i, OPT_RESULT(UDP_TARGET));
+ if (udp_resolve_target(arg, &scd) < 0)
- s->client_cmds[SENDER_ON] = udp_com_on;
- s->client_cmds[SENDER_OFF] = udp_com_off;
- s->client_cmds[SENDER_DENY] = NULL;
- s->client_cmds[SENDER_ALLOW] = NULL;
- s->client_cmds[SENDER_ADD] = udp_com_add;
- s->client_cmds[SENDER_DELETE] = udp_com_delete;
- sender_status = SENDER_OFF;
+ s->client_cmds[SENDER_on] = udp_com_on;
+ s->client_cmds[SENDER_off] = udp_com_off;
+ s->client_cmds[SENDER_deny] = NULL;
+ s->client_cmds[SENDER_allow] = NULL;
+ s->client_cmds[SENDER_add] = udp_com_add;
+ s->client_cmds[SENDER_delete] = udp_com_delete;
+ sender_status = SENDER_off;