/* finished iterating */
o_stream_unset_flush_callback(conn->output);
dict_iterate_deinit(&conn->iter_ctx);
- o_stream_send(conn->output, "\n", 1);
+
+ str_truncate(str, 0);
+ if (ret < 0)
+ str_append_c(str, DICT_PROTOCOL_REPLY_FAIL);
+ str_append_c(str, '\n');
+ o_stream_send(conn->output, str_data(str), str_len(str));
}
o_stream_uncork(conn->output);
return ret <= 0 ? 1 : 0;
/* line contains key \t value */
p_clear(ctx->pool);
- if (*line != DICT_PROTOCOL_REPLY_OK)
- value = NULL;
- else
+ switch (*line) {
+ case DICT_PROTOCOL_REPLY_OK:
value = strchr(++line, '\t');
+ break;
+ case DICT_PROTOCOL_REPLY_FAIL:
+ return -1;
+ default:
+ value = NULL;
+ break;
+ }
if (value == NULL) {
/* broken protocol */
i_error("dict client (%s) sent broken reply", dict->path);