#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"
static struct list_head targets;
static int sender_status;
+static struct sender *self;
static void udp_close_target(struct udp_target *ut)
{
/** 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;
}
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;
}
size_t len = 0; /* STFU, gcc */
list_for_each_entry_safe(ut, tmp, &targets, node) {
+ int ubuntu_glibc_headers_suck;
if (ut->fd < 0)
continue;
if (!buf)
len = vss_get_fec_eof_packet(&buf);
- write(ut->fd, buf, len);
+ /* ignore return value, we're closing the target anyway. */
+ ubuntu_glibc_headers_suck = write(ut->fd, buf, len); /* STFU */
udp_close_target(ut);
}
}
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;
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)
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;
udp_init_target_list();
if (!conf.udp_no_autostart_given)
sender_status = SENDER_ON;
+ self = s;
PARA_DEBUG_LOG("udp sender init complete\n");
}