static void udp_add_target(struct sender_command_data *scd)
{
- int ret, port = scd->port > 0 ? scd->port : conf.udp_default_port_arg;
+ int ret;
struct udp_target *ut = para_calloc(sizeof(*ut));
- strncpy(ut->host, scd->host, sizeof(ut->host));
- ut->port = scd->port > 0 ? scd->port : conf.udp_default_port_arg;
-
ut->fcp.slices_per_group = scd->slices_per_group;
ut->fcp.data_slices_per_group = scd->data_slices_per_group;
ut->fcp.max_slice_bytes = scd->max_slice_bytes;
ut->sc = para_calloc(sizeof(*ut->sc));
ut->sc->private_data = ut;
ut->sc->fd = -1;
- ret = para_connect_simple(IPPROTO_UDP, scd->host, port);
+ ret = para_connect_simple(IPPROTO_UDP, scd->host, scd->port);
if (ret < 0)
goto err;
ut->sc->fd = ret;
err:
if (ut->sc->fd >= 0)
close(ut->sc->fd);
- PARA_NOTICE_LOG("failed to set up %s#%d (%s)- not adding it\n",
- scd->host, port, para_strerror(-ret));
+ PARA_NOTICE_LOG("failed to set up %s:%d (%s)- not adding it\n",
+ scd->host, scd->port, para_strerror(-ret));
free(ut->sc);
free(ut);
}
INIT_LIST_HEAD(&targets);
for (i = 0; i < conf.udp_target_given; i++) {
- if (parse_fec_url(conf.udp_target_arg[i], &scd) < 0) {
- PARA_CRIT_LOG("syntax error for udp target option "
- "#%d, ignoring\n", i);
- continue;
- }
- udp_add_target(&scd);
+ if (udp_resolve_target(conf.udp_target_arg[i], &scd) < 0)
+ PARA_CRIT_LOG("not adding requested target '%s'\n",
+ conf.udp_target_arg[i]);
+ else
+ udp_add_target(&scd);
}
}