+static void dccp_shutdown_client(struct sender_client *sc)
+{
+ struct dccp_fec_client *dfc = sc->private_data;
+
+ vss_del_fec_client(dfc->fc);
+ shutdown_client(sc, dss);
+}
+
+static void dccp_shutdown_clients(void)
+{
+ struct sender_client *sc, *tmp;
+
+ list_for_each_entry_safe(sc, tmp, &dss->client_list, node)
+ dccp_shutdown_client(sc);
+}
+
+/** * Obtain current MPS according to RFC 4340, sec. 14. */
+static int dccp_init_fec(struct sender_client *sc)
+{
+ int mps, ret;
+ socklen_t ml = sizeof(mps);
+
+ /* If call fails, return some sensible minimum value */
+ ret = getsockopt(sc->fd, SOL_DCCP, DCCP_SOCKOPT_GET_CUR_MPS, &mps, &ml);
+ if (ret < 0) {
+ PARA_NOTICE_LOG("can not determine MPS: %s\n", strerror(errno));
+ mps = generic_max_transport_msg_size(sc->fd) - DCCP_MAX_HEADER;
+ }
+ PARA_INFO_LOG("current MPS = %d bytes\n", mps);
+ assert(mps > 0);
+ if (conf.dccp_max_slice_size_arg > 0)
+ mps = PARA_MIN(mps, conf.dccp_max_slice_size_arg);
+ return mps;
+}
+
+static void dccp_send_fec(struct sender_client *sc, char *buf, size_t len)
+{
+ int ret = xwrite(sc->fd, buf, len);
+
+ if (ret < 0)
+ dccp_shutdown_client(sc);
+}
+