]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - udp_send.c
udp: Also send the EOF packet when a target is removed.
[paraslash.git] / udp_send.c
index 35637f7ada278e9dcfbe06d8447c0ec58aadc457..9092985725b5289ee7391eba3df2c12ae4e62844 100644 (file)
@@ -54,7 +54,12 @@ static int sender_status;
 
 static void udp_close_target(struct sender_client *sc)
 {
+       const char *buf;
+       size_t len = vss_get_fec_eof_packet(&buf);
+
        if (sc->cq != NULL) {
+               /* ignore return value, closing the target anyway. */
+               (void)write(sc->fd, buf, len);
                cq_destroy(sc->cq);
                sc->cq = NULL;
        }
@@ -165,15 +170,8 @@ static void udp_init_session(struct sender_client *sc)
 static void udp_shutdown_targets(void)
 {
        struct sender_client *sc, *tmp;
-       const char *buf;
-       size_t len = vss_get_fec_eof_packet(&buf);
-
        list_for_each_entry_safe(sc, tmp, &targets, node)
-               if (sc->cq != NULL) {
-                       /* ignore return value, closing the target anyway. */
-                       (void)write(sc->fd, buf, len);
-                       udp_close_target(sc);
-               }
+               udp_close_target(sc);
 }
 
 static int udp_resolve_target(const char *url, struct sender_command_data *scd)