From bc5569ab94a0c82d316686212e5f984ea945f637 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 13 Oct 2008 11:17:30 +0200 Subject: [PATCH] luaa: send back but do not block (FS#338) Signed-off-by: Julien Danjou --- luaa.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/luaa.c b/luaa.c index 2e55179e..fe7f2ea7 100644 --- a/luaa.c +++ b/luaa.c @@ -907,8 +907,16 @@ luaA_cb(EV_P_ ev_io *w, int revents) s = lua_tolstring(globalconf.L, -1, &len); /* ignore ENOENT because the client may not read */ - if (send(w->fd, s, len, 0) == -1 && errno != ENOENT) - warn("can't send back to client via domain socket: %s", strerror(errno)); + if (send(w->fd, s, len, MSG_DONTWAIT) == -1) + switch(errno) + { + case ENOENT: + case EAGAIN: + break; + default: + warn("can't send back to client via domain socket: %s", strerror(errno)); + break; + } lua_pop(globalconf.L, 1); /* pop the string */ }