+ 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);
+}
+
+static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds)
+{
+ struct sender_client *sc;
+ struct dccp_fec_client *dfc;
+ int tx_ccid;
+
+ sc = accept_sender_client(dss, rfds);
+ if (!sc)
+ return;
+
+ /* If CCID identifiable, present client as <host>#<port>~<ccid> */
+ tx_ccid = dccp_get_tx_ccid(sc->fd);
+ if (tx_ccid != -1) {
+ char *tmp = make_message("%s~%d", sc->name, tx_ccid);
+
+ free(sc->name);
+ sc->name = tmp;
+ }
+ /*
+ * Bypass unused CCID paths: the sender does not receive application data
+ * from the client; by shutting down this unused communication path we can
+ * reduce processing costs a bit. See analogous comment in dccp_recv.c.
+ */
+ if (shutdown(sc->fd, SHUT_RD) < 0) {
+ PARA_WARNING_LOG("%s\n", strerror(errno));
+ shutdown_client(sc, dss);
+ return;
+ }
+ dfc = para_calloc(sizeof(*dfc));
+ sc->private_data = dfc;
+ dfc->fcp.data_slices_per_group = conf.dccp_data_slices_per_group_arg;
+ dfc->fcp.slices_per_group = conf.dccp_slices_per_group_arg;
+ dfc->fcp.init_fec = dccp_init_fec;
+ dfc->fcp.send_fec = dccp_send_fec;
+ dfc->fcp.need_periodic_header = false;
+ dfc->fc = vss_add_fec_client(sc, &dfc->fcp);