io_add(services[i]->status_fd[0], IO_READ,
service_status_input, services[i]);
}
- if (services[i]->status_fd[0] != -1) {
- service_monitor_start_extra_avail(services[i]);
- service_monitor_listen_start(services[i]);
- }
+ service_monitor_start_extra_avail(services[i]);
+ service_monitor_listen_start(services[i]);
}
if (service_process_create(service_list->log) != NULL)
struct service *service;
pid_t pid;
int status;
- bool service_destroyed;
+ bool service_stopped;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
process = hash_table_lookup(service_pids, &pid);
} else {
service_process_failure(process, status);
}
- service_destroyed = service->list->destroyed;
+ service_stopped = service->status_fd[0] == -1;
if (service->type == SERVICE_TYPE_ANVIL)
service_anvil_process_destroyed(process);
service_process_destroy(process);
- if (!service_destroyed) {
+ if (!service_stopped) {
service_monitor_start_extra_avail(service);
if (service->to_throttle == NULL)
service_monitor_listen_start(service);
closelog();
if (dup2_array(&dups) < 0)
- service_error(service, "dup2s failed");
+ i_fatal("service(%s): dup2s failed", service->set->name);
env_put(t_strdup_printf("SOCKET_COUNT=%d", socket_listener_count));
env_put(t_strdup_printf("SSL_SOCKET_COUNT=%d", ssl_socket_count));
pid_t pid;
bool process_forked;
+ i_assert(service->status_fd[0] != -1);
+
if (service->to_throttle != NULL) {
/* throttling service, don't create new processes */
return NULL;