From 10c65c7ac06008347003fd39aeb513efaa741964 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Sun, 23 May 2010 07:43:04 +0200 Subject: [PATCH] udp_send: send data in MMS-sized chunks This determines the Maximum Message Size for the UDPv4/v6 layer; using the earlier functions. The outcome is used to set the FEC slice size, initialisation of the UDP client has also been moved to the init_fec() function. --- udp_send.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/udp_send.c b/udp_send.c index 5c1cdf02..a7d696ef 100644 --- a/udp_send.c +++ b/udp_send.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -232,6 +233,19 @@ static int udp_com_delete(struct sender_command_data *scd) return 1; } +/** Initialize UDP session and set maximum payload size. */ +static int udp_init_fec(struct sender_client *sc) +{ + int mps, ret = udp_init_session(sc); + + if (ret < 0) + return ret; + + mps = generic_max_transport_msg_size(sc->fd) - sizeof(struct udphdr); + PARA_INFO_LOG("current MPS = %d bytes\n", mps); + return mps; +} + static int udp_send_fec(struct sender_client *sc, char *buf, size_t len) { struct udp_target *ut = sc->private_data; @@ -278,7 +292,7 @@ static void udp_add_target(struct sender_command_data *scd) 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.init_fec = NULL; /* FIXME */ + ut->fcp.init_fec = udp_init_fec; ut->fcp.send_fec = udp_send_fec; ut->sc = para_calloc(sizeof(*ut->sc)); -- 2.39.2