auth-request-balancer-worker.c revision 70905e51a5148bd5613cb04720807177474a2496
/* Copyright (C) 2002-2005 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "network.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "auth-request-handler.h"
#include "auth-request-balancer.h"
#include <stdlib.h>
#include <unistd.h>
struct auth_balancer_worker {
int fd;
struct auth_request_handler *request_handler;
};
{
if (p == NULL)
else {
*line = p + 1;
}
}
static char *balancer_socket_path;
static struct timeout *to_connect;
static void
{
}
}
static void balancer_worker_input(void *context)
{
char *line;
case 0:
return;
case -1:
/* disconnected */
return;
case -2:
/* buffer full */
i_error("BUG: Auth balancer server sent us more than %d bytes",
return;
}
t_push();
t_pop();
}
}
static int balancer_worker_output(void *context)
{
return 1;
}
/* FIXME: throttle control.. */
return 1;
}
{
/* request handler was destroyed */
return;
}
}
{
struct auth_balancer_worker *worker;
worker);
}
{
i_error("close(balancer) failed: %m");
}
{
int fd;
if (fd < 0) {
i_fatal("net_connect_unix(%s) failed: %m",
}
/* busy */
return FALSE;
}
return TRUE;
}
static void balancer_connect_timeout(void *context)
{
if (auth_request_balancer_connect(auth)) {
to_connect = NULL;
}
}
{
const char *name;
if (!auth_request_balancer_connect(auth)) {
/* couldn't connect to balancer yet, it's probably still
starting. try again later. */
}
}
void auth_request_balancer_worker_deinit(void)
{
if (to_connect != NULL)
}