*max_fd = max(*max_fd, sock);
l->fd.cb = uh_listener_cb;
- uloop_fd_add(&l->fd, ULOOP_READ | ULOOP_WRITE);
+ uloop_fd_add(&l->fd, ULOOP_READ);
bound++;
continue;
if ((cl = uh_client_add(new_fd, serv)) != NULL)
{
/* add client socket to global fdset */
- uloop_fd_add(&cl->fd, ULOOP_READ | ULOOP_WRITE);
+ uloop_fd_add(&cl->fd, ULOOP_READ);
#ifdef HAVE_TLS
/* setup client tls context */
}
}
+static void uh_pipe_cb(struct uloop_fd *u, unsigned int events)
+{
+ struct client *cl = container_of(u, struct client, pipe);
+
+ D("SRV: Client(%d) pipe(%d) readable\n", cl->fd.fd, cl->pipe.fd);
+
+ uh_client_cb(&cl->fd, ULOOP_WRITE);
+}
+
static void uh_child_cb(struct uloop_process *p, int rv)
{
struct client *cl = container_of(p, struct client, proc);
return;
}
+ /* request handler spawned a pipe, register handler */
+ if (cl->pipe.fd)
+ {
+ D("SRV: Client(%d) pipe(%d) spawned\n", u->fd, cl->pipe.fd);
+
+ cl->pipe.cb = uh_pipe_cb;
+ uloop_fd_add(&cl->pipe, ULOOP_READ);
+ }
+
/* request handler spawned a child, register handler */
if (cl->proc.pid)
{
/* header processing complete */
D("SRV: Client(%d) dispatched\n", u->fd);
cl->dispatched = true;
- return;
}
if (!cl->cb(cl))