From ce9c411a5bee664ea2bbe5d4614b81830a14a41b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 26 Jul 2017 20:45:27 +0200 Subject: [PATCH] udp sender: Send EOF package only once. We already have the per target ->sent_fec_eof flag, but we only set it after the EOF packet was sent *successfully*. It's pointless to send the packet more than once, so this patch modifies udp_close_target() to set the flag regardless of whether the write(2) call succeeded. --- udp_send.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udp_send.c b/udp_send.c index 425118a1..2eb33b53 100644 --- a/udp_send.c +++ b/udp_send.c @@ -64,8 +64,9 @@ static void udp_close_target(struct sender_client *sc) 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; + if (write(sc->fd, buf, len)) + do_nothing; /* avoid "ignoring return value" warning */ + ut->sent_fec_eof = true; } static void udp_delete_target(struct sender_client *sc, const char *msg) -- 2.39.5