socket-proxy: port to new sd_event_source_set_exit_on_failure() API

This commit is contained in:
Lennart Poettering 2020-10-01 22:21:05 +02:00
parent 76c59537f3
commit ccaa30c199

View file

@ -528,11 +528,8 @@ static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdat
} }
r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT); r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT);
if (r < 0) { if (r < 0)
log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m"); return log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
sd_event_exit(context->event, r);
return r;
}
return 1; return 1;
} }
@ -561,11 +558,14 @@ static int add_listen_socket(Context *context, int fd) {
r = set_ensure_put(&context->listen, NULL, source); r = set_ensure_put(&context->listen, NULL, source);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to add source to set: %m");
sd_event_source_unref(source); sd_event_source_unref(source);
return r; return log_error_errno(r, "Failed to add source to set: %m");
} }
r = sd_event_source_set_exit_on_failure(source, true);
if (r < 0)
return log_error_errno(r, "Failed to enable exit-on-failure logic: %m");
/* Set the watcher to oneshot in case other processes are also /* Set the watcher to oneshot in case other processes are also
* watching to accept(). */ * watching to accept(). */
r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT); r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);