X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=udp_send.c;h=478c5d9fcfa58c80097cb21f67a7748c964aae12;hp=e80670d0f3866dcde32114c0459a506b8cb78cff;hb=96dd1284a1b7d565560979fdc7ec647aeceb6b52;hpb=e90440367f744a7723b201a95888e66f070ffa92 diff --git a/udp_send.c b/udp_send.c index e80670d0..478c5d9f 100644 --- a/udp_send.c +++ b/udp_send.c @@ -21,9 +21,9 @@ #include "afh.h" #include "afs.h" #include "server.h" -#include "vss.h" #include "list.h" #include "send.h" +#include "vss.h" #include "portable_io.h" #include "net.h" #include "fd.h" @@ -51,6 +51,7 @@ struct udp_target { static struct list_head targets; static int sender_status; +static struct sender *self; static void udp_close_target(struct udp_target *ut) { @@ -152,8 +153,9 @@ err: /** The maximal size of the per-target chunk queue. */ #define UDP_CQ_BYTES 40000 -static int udp_init_session(struct udp_target *ut) +static int udp_open(void *client, struct fec_client_parms **fcp) { + struct udp_target *ut = client; int ret; char *iface = NULL; @@ -181,6 +183,8 @@ static int udp_init_session(struct udp_target *ut) } add_close_on_fork_list(ut->fd); ut->cq = cq_new(UDP_CQ_BYTES); + ut->fcp.max_slice_bytes = 1472; /* FIXME */ + *fcp = &ut->fcp; PARA_NOTICE_LOG("sending to udp %s#%d\n", ut->host, ut->port); return 1; } @@ -238,9 +242,6 @@ static int udp_send_fec(char *buf, size_t len, void *private_data) if (sender_status == SENDER_OFF) return 0; - ret = udp_init_session(ut); - if (ret < 0) - goto fail; ret = send_queued_chunks(ut->fd, ut->cq, 0); if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) ret = 0; @@ -278,10 +279,7 @@ static void udp_add_target(struct sender_command_data *scd) para_list_add(&ut->node, &targets); 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->fcp.send = udp_send_fec; - ut->fcp.private_data = ut; - vss_add_fec_client(&ut->fcp, &ut->fc); + /* XXX RESOLVED LATER vss_add_fec_client(self, ut, &ut->fc); */ } static int udp_com_add(struct sender_command_data *scd) @@ -366,6 +364,8 @@ void udp_send_init(struct sender *s) s->info = udp_info; s->help = udp_help; s->send = NULL; + s->send_fec = udp_send_fec; + s->open = udp_open; s->pre_select = NULL; s->post_select = NULL; s->shutdown_clients = udp_shutdown_targets; @@ -379,5 +379,6 @@ void udp_send_init(struct sender *s) udp_init_target_list(); if (!conf.udp_no_autostart_given) sender_status = SENDER_ON; + self = s; PARA_DEBUG_LOG("udp sender init complete\n"); }