notify-connection.c revision e34d170f8f0e084bd94bfbc1a7085ece67e508df
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "llist.h"
#include "istream.h"
#include "ostream.h"
#include "strescape.h"
#include "master-service.h"
#include "replicator-queue.h"
#include "notify-connection.h"
#include <unistd.h>
#define NOTIFY_CLIENT_PROTOCOL_MAJOR_VERSION 1
#define NOTIFY_CLIENT_PROTOCOL_MINOR_VERSION 0
struct notify_connection {
int refcount;
int fd;
struct replicator_queue *queue;
unsigned int version_received:1;
unsigned int destroyed:1;
};
struct notify_sync_request {
struct notify_connection *conn;
unsigned int id;
};
static struct notify_connection *connections;
{
}
static int
{
struct notify_sync_request *request;
const char *const *args;
enum replication_priority priority;
unsigned int id;
/* U \t <username> \t <priority> [\t <sync id>] */
return -1;
}
return -1;
}
return -1;
}
if (priority != REPLICATION_PRIORITY_SYNC)
return -1;
} else {
}
return 0;
}
{
const char *line;
int ret;
case -2:
i_error("BUG: Client connection sent too much data");
return;
case -1:
return;
}
if (!conn->version_received) {
return;
i_error("Notify client not compatible with this server "
"(mixed old and new binaries?)");
return;
}
}
T_BEGIN {
} T_END;
if (ret < 0) {
break;
}
}
}
struct notify_connection *
{
struct notify_connection *conn;
return conn;
}
{
return;
i_error("close(notify connection) failed: %m");
}
{
}
{
return;
}
void notify_connections_destroy_all(void)
{
while (connections != NULL)
}