main.c revision cca4ba2a504d70a9fe9fee37f8433997359de52c
#include "lib.h"
#include "lib-signals.h"
#include "array.h"
#include "ostream.h"
#include "restrict-access.h"
#include "master-service.h"
#include "master-service-settings.h"
#include "ssl-params-settings.h"
#include "ssl-params.h"
#define SSL_BUILD_PARAM_FNAME "ssl-parameters.dat"
#define STARTUP_IDLE_TIMEOUT_MSECS 1000
struct client {
int fd;
};
static ARRAY(int) delayed_fds;
struct ssl_params *param;
static buffer_t *ssl_params;
static struct timeout *to_startup;
{
}
{
if (o_stream_flush(output) == 0) {
/* more to come */
return 0;
}
/* finished / disconnected */
return -1;
}
static void client_handle(int fd)
{
else {
output);
}
}
{
if (to_startup != NULL)
if (ssl_params->used == 0) {
/* waiting for parameter building to finish */
if (!array_is_created(&delayed_fds))
} else {
}
}
{
const int *fds;
if (!array_is_created(&delayed_fds)) {
/* if we don't get client connections soon, it means master
ran us at startup to make sure ssl parameters are generated
asap. if we're here because of that, don't bother hanging
around to see if we get any client connections. */
if (to_startup == NULL) {
}
return;
}
client_handle(*fds);
}
{
int status;
i_error("waitpid() failed: %m");
else if (status != 0)
else {
/* params should have been created now. try refreshing. */
}
}
{
const struct master_service_settings *service_set;
const char *filename;
}
static void main_deinit(void)
{
if (to_startup != NULL)
if (array_is_created(&delayed_fds))
}
{
const struct ssl_params_settings *set;
if (master_getopt(master_service) > 0)
return FATAL_DEFAULT;
#ifndef HAVE_SSL
i_fatal("Dovecot built without SSL support");
#endif
main_deinit();
return 0;
}