dsync-proxy-client.c revision 3fe67ec75ccae1230bb9eb9f16affc48377f6441
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenstruct proxy_client_dsync_worker_mailbox_iter {
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen ARRAY_DEFINE(request_array, struct proxy_client_request);
602a0434db30d8e3292d1c161a803d96a879a74fTimo Sirainenextern struct dsync_worker_vfuncs proxy_client_dsync_worker;
602a0434db30d8e3292d1c161a803d96a879a74fTimo Sirainenstatic void proxy_client_worker_input(struct proxy_client_dsync_worker *worker);
07e4875d250e7a7157cd99132aafc773cf3cdf83Timo Sirainenstatic void proxy_client_send_stream(struct proxy_client_dsync_worker *worker);
7d207b1e77a7b5e3fda640e353acfc86d261fedfTimo Sirainenstatic void proxy_client_fail(struct proxy_client_dsync_worker *worker)
7e1f68ad71d3485f1882142837b01f7a98ca8467Timo Sirainenproxy_client_worker_read_line(struct proxy_client_dsync_worker *worker,
89e195dfb5c4b0efd9b9f459771a4467674e5b1fTimo Sirainen const char **line_r)
137ea7ca34005345aa2304a940149b7f3774d727Timo Sirainen *line_r = i_stream_read_next_line(worker->input);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen i_error("read() from worker server failed: %m");
c06f4017027263cf3a08becc551f5126409e2a83Timo Sirainen i_error("read() from worker server failed: EOF");
282a436a74d8835edb45cc019b1c916013013fd3Timo Sirainen if (strcmp(*line_r, DSYNC_PROXY_SERVER_GREETING_LINE) != 0) {
282a436a74d8835edb45cc019b1c916013013fd3Timo Sirainen i_error("Invalid server handshake: %s", *line_r);
const unsigned char *data;
const char *line)
return TRUE;
const char *line)
const char *p, *error;
switch (line[0]) {
&error) < 0) {
return FALSE;
worker);
const char *line)
const char *line)
return FALSE;
return ret;
const char *line;
int ret;
if (ret < 0) {
int ret;
return ret;
worker);
return TRUE;
static struct dsync_worker_mailbox_iter *
int ret;
if (ret < 0)
return ret;
return ret;
static struct dsync_worker_subs_iter *
unsigned int wanted_arg_count,
char ***args_r)
const char *line;
char **args;
int ret;
if (ret < 0)
return ret;
char **args;
int ret;
if (ret <= 0)
return ret;
char **args;
int ret;
if (ret <= 0)
return ret;
return ret;
bool set)
T_BEGIN {
} T_END;
struct proxy_client_dsync_worker_msg_iter {
bool done;
static struct dsync_worker_msg_iter *
unsigned int mailbox_count)
} T_END;
unsigned int *mailbox_idx_r,
int ret;
if (ret < 0)
return ret;
*mailbox_idx_r = 0;
line++;
line++;
return ret;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
T_BEGIN {
} T_END;
void *context)
T_BEGIN {
} T_END;
const unsigned char *data;
int ret;
if (ret == 0) {
T_BEGIN {
} T_END;
void *context)
T_BEGIN {
} T_END;
void *context)