]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: make live log sockets non-blocking
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 5 Mar 2022 18:43:05 +0000 (19:43 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 7 Mar 2022 17:03:15 +0000 (18:03 +0100)
This was the intent here to begin with, not sure where I managed to
forget this along the way...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/zlog_live.c

index eeedf5c4258a1f73ffb3cb6baf0c6e2ea3178873..7abf1a801a9459880568e8dd10a630e10898bac9 100644 (file)
@@ -22,6 +22,7 @@
 #include "frrcu.h"
 #include "zlog.h"
 #include "printfrr.h"
+#include "network.h"
 
 DEFINE_MTYPE_STATIC(LOG, LOG_LIVE, "log vtysh live target");
 
@@ -109,6 +110,8 @@ static void zlog_live(struct zlog_target *zt, struct zlog_msg *msgs[],
        for (size_t msgpos = 0; msgpos < msgtotal; msgpos += sent) {
                sent = sendmmsg(fd, mmhs + msgpos, msgtotal - msgpos, 0);
 
+               if (sent <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
+                       break;
                if (sent <= 0)
                        goto out_err;
        }
@@ -195,6 +198,7 @@ void zlog_live_open(struct zlog_live_cfg *cfg, int prio_min, int *other_fd)
        zte = container_of(zt, struct zlt_live, zt);
        cfg->target = zte;
 
+       set_nonblocking(sockets[0]);
        zte->fd = sockets[0];
        zte->zt.prio_min = prio_min;
        zte->zt.logfn = zlog_live;