struct fec_client *fc;
/** The FEC parameters for this target. */
struct fec_client_parms fcp;
+ /** Whether we already sent the FEC eof packet to this target. */
+ bool sent_fec_eof;
};
static struct list_head targets;
static void udp_close_target(struct sender_client *sc)
{
const char *buf;
- size_t len = vss_get_fec_eof_packet(&buf);
-
- /*
- * Ignore the return value of write() since we are closing the target
- * anyway. The sole purpose of the "do_nothing" statement is to silence
- * gcc.
- */
- if (write(sc->fd, buf, len))
- do_nothing;
+ size_t len;
+ struct udp_target *ut = sc->private_data;
+
+ if (ut->sent_fec_eof)
+ return;
+ PARA_NOTICE_LOG("sending FEC EOF\n");
+ len = vss_get_fec_eof_packet(&buf);
+ /* Ignore write() errors since we are closing the target anyway. */
+ if (write(sc->fd, buf, len) == len)
+ ut->sent_fec_eof = true;
}
static void udp_delete_target(struct sender_client *sc, const char *msg)
/** Initialize UDP session and set maximum payload size. */
static int udp_init_fec(struct sender_client *sc)
{
+ struct udp_target *ut = sc->private_data;
int mps;
PARA_NOTICE_LOG("sending to udp %s\n", sc->name);
+ ut->sent_fec_eof = false;
mps = generic_max_transport_msg_size(sc->fd) - sizeof(struct udphdr);
PARA_INFO_LOG("current MPS = %d bytes\n", mps);
return mps;