Fix on_unit_ready()
Got it wrong and lighttpd doesn't have any mercy.
This commit is contained in:
parent
903f7d128a
commit
7ee3bbc86b
32
ponymap.c
32
ponymap.c
|
@ -565,12 +565,15 @@ unit_update_poller (struct unit *u, const struct pollfd *pfd)
|
||||||
static void
|
static void
|
||||||
on_unit_ready (const struct pollfd *pfd, struct unit *u)
|
on_unit_ready (const struct pollfd *pfd, struct unit *u)
|
||||||
{
|
{
|
||||||
struct transport *transport = u->transport;
|
|
||||||
struct service *service = u->service;
|
struct service *service = u->service;
|
||||||
|
struct transport *transport = u->transport;
|
||||||
enum transport_io_result result;
|
enum transport_io_result result;
|
||||||
|
bool got_eof = false;
|
||||||
|
|
||||||
|
if ((result = transport->on_readable (u)) == TRANSPORT_IO_ERROR)
|
||||||
|
goto error;
|
||||||
|
got_eof |= result == TRANSPORT_IO_EOF;
|
||||||
|
|
||||||
if ((result = transport->on_readable (u)))
|
|
||||||
goto exception;
|
|
||||||
if (u->read_buffer.len)
|
if (u->read_buffer.len)
|
||||||
{
|
{
|
||||||
struct str *buf = &u->read_buffer;
|
struct str *buf = &u->read_buffer;
|
||||||
|
@ -581,23 +584,24 @@ on_unit_ready (const struct pollfd *pfd, struct unit *u)
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result = transport->on_writeable (u)))
|
if ((result = transport->on_writeable (u)) == TRANSPORT_IO_ERROR)
|
||||||
goto exception;
|
goto error;
|
||||||
|
got_eof |= result == TRANSPORT_IO_EOF;
|
||||||
|
|
||||||
|
if (got_eof)
|
||||||
|
{
|
||||||
|
if (service->on_eof)
|
||||||
|
service->on_eof (u->service_data, u);
|
||||||
|
if (u->abortion_requested || !u->write_buffer.len)
|
||||||
|
goto abort;
|
||||||
|
}
|
||||||
|
|
||||||
unit_update_poller (u, pfd);
|
unit_update_poller (u, pfd);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
exception:
|
error:
|
||||||
if (result == TRANSPORT_IO_EOF)
|
|
||||||
{
|
|
||||||
if (service->on_eof)
|
|
||||||
service->on_eof (u->service_data, u);
|
|
||||||
}
|
|
||||||
else if (result == TRANSPORT_IO_ERROR)
|
|
||||||
{
|
|
||||||
if (service->on_error)
|
if (service->on_error)
|
||||||
service->on_error (u->service_data, u);
|
service->on_error (u->service_data, u);
|
||||||
}
|
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
unit_abort (u);
|
unit_abort (u);
|
||||||
|
|
Loading…
Reference in New Issue