[systemd-devel] [PATCH v2 19/26] dhcp: Add timeout and main loop support

Lennart Poettering lennart at poettering.net
Wed Nov 27 12:29:17 PST 2013


On Wed, 27.11.13 16:57, Patrik Flykt (Patrik.Flykt at linux.intel.com) wrote:

> 
> 	Hi,
> 
> On Tue, 2013-11-26 at 05:32 +0100, Zbigniew Jędrzejewski-Szmek wrote:
> > > +static int client_timeout_resend(sd_event_source *s, uint64_t usec,
> > > +                                 void *userdata)
> > > +{
> ...
> > > +
> > > +        return 0;
> > > +
> > > +error:
> > > +        client_stop(client, err);
> > > +
> > > +        return 0;
> > Return err?
> 
> Here I didn't want to spill the error back to the event handling loop
> code as the situation is handled internally by stopping the client and
> giving the error reason to a registered callback (in patch 25/26) via
> 'client_stop()'.

Just to mention this in this context:

I think I'll rework sd-event to not ripple up the error values returned
by event callbacks. It makes code too fragile, and for example in PID 1
we never want to have th event loop fail, just because some event
handler returned negative. We should keep event erros local to the event
handling and not turn them into global failures of the entire program.

Instead I'll probably change things to eat up any error returned by an
event callback, however the event source is turned off when this
happens, to keep the error local.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list