summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1fa9dbe)
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.
#include <sys/time.h>
#include <dirent.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <dirent.h>
#include <sys/socket.h>
+#include <netinet/udp.h>
#include <net/if.h>
#include <osl.h>
#include <net/if.h>
#include <osl.h>
+/** 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;
static int udp_send_fec(struct sender_client *sc, char *buf, size_t len)
{
struct udp_target *ut = sc->private_data;
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.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));
ut->fcp.send_fec = udp_send_fec;
ut->sc = para_calloc(sizeof(*ut->sc));