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
1 changed files with 7 additions and 7 deletions

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);
if (r < 0) {
log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
sd_event_exit(context->event, r);
return r;
}
if (r < 0)
return log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
return 1;
}
@ -561,11 +558,14 @@ static int add_listen_socket(Context *context, int fd) {
r = set_ensure_put(&context->listen, NULL, source);
if (r < 0) {
log_error_errno(r, "Failed to add source to set: %m");
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
* watching to accept(). */
r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);