dovecot-2.2: dict-client: Disconnect from server on unexpected e...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Sep 23 20:01:52 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/891ff25af7ce
changeset: 19197:891ff25af7ce
user: Timo Sirainen <tss at iki.fi>
date: Wed Sep 23 22:49:41 2015 +0300
description:
dict-client: Disconnect from server on unexpected errors.
diffstat:
src/lib-dict/dict-client.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diffs (51 lines):
diff -r 6bacd85b1a2e -r 891ff25af7ce src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c Wed Sep 23 16:10:27 2015 +0300
+++ b/src/lib-dict/dict-client.c Wed Sep 23 22:49:41 2015 +0300
@@ -180,6 +180,7 @@
if (o_stream_send_str(dict->output, query) < 0 ||
o_stream_flush(dict->output) < 0) {
i_error("write(%s) failed: %m", dict->path);
+ client_dict_disconnect(dict);
return -1;
}
}
@@ -311,7 +312,8 @@
return ret;
}
-static int client_dict_read_one_line(struct client_dict *dict, char **line_r)
+static int
+client_dict_read_one_line_real(struct client_dict *dict, char **line_r)
{
unsigned int id;
char *line;
@@ -355,11 +357,11 @@
default:
i_error("dict-client: Invalid async commit line: %s",
line);
- return 0;
+ return -1;
}
if (str_to_uint(line+2, &id) < 0) {
i_error("dict-client: Invalid ID");
- return 0;
+ return -1;
}
client_dict_finish_transaction(dict, id, ret);
return 0;
@@ -368,6 +370,15 @@
return 1;
}
+static int client_dict_read_one_line(struct client_dict *dict, char **line_r)
+{
+ int ret;
+
+ if ((ret = client_dict_read_one_line_real(dict, line_r)) < 0)
+ client_dict_disconnect(dict);
+ return ret;
+}
+
static bool client_dict_is_finished(struct client_dict *dict)
{
return dict->transactions == NULL && !dict->in_iteration &&
More information about the dovecot-cvs
mailing list