luaa: send back but do not block (FS#338)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-13 11:17:30 +02:00
parent bda6282df7
commit bc5569ab94
1 changed files with 10 additions and 2 deletions

12
luaa.c
View File

@ -907,8 +907,16 @@ luaA_cb(EV_P_ ev_io *w, int revents)
s = lua_tolstring(globalconf.L, -1, &len); s = lua_tolstring(globalconf.L, -1, &len);
/* ignore ENOENT because the client may not read */ /* ignore ENOENT because the client may not read */
if (send(w->fd, s, len, 0) == -1 && errno != ENOENT) if (send(w->fd, s, len, MSG_DONTWAIT) == -1)
warn("can't send back to client via domain socket: %s", strerror(errno)); 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 */ lua_pop(globalconf.L, 1); /* pop the string */
} }