Mercurial > dovecot > core-2.2
changeset 18677:e6e04177374d
fts-solr: Crashfixes
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 13 May 2015 16:54:27 +0300 |
parents | 5483aeb1ce9b |
children | 8973648dd361 |
files | src/plugins/fts-solr/fts-backend-solr-old.c src/plugins/fts-solr/fts-backend-solr.c src/plugins/fts-solr/solr-connection.c src/plugins/fts-solr/solr-connection.h |
diffstat | 4 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/fts-solr/fts-backend-solr-old.c Wed May 13 16:46:14 2015 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr-old.c Wed May 13 16:54:27 2015 +0300 @@ -433,7 +433,7 @@ solr_connection_post_more(ctx->post, str_data(ctx->cmd), str_len(ctx->cmd)); - return solr_connection_post_end(ctx->post); + return solr_connection_post_end(&ctx->post); } static int
--- a/src/plugins/fts-solr/fts-backend-solr.c Wed May 13 16:46:14 2015 +0300 +++ b/src/plugins/fts-solr/fts-backend-solr.c Wed May 13 16:54:27 2015 +0300 @@ -339,7 +339,7 @@ solr_connection_post_more(ctx->post, str_data(ctx->cmd), str_len(ctx->cmd)); - return solr_connection_post_end(ctx->post); + return solr_connection_post_end(&ctx->post); } static void
--- a/src/plugins/fts-solr/solr-connection.c Wed May 13 16:46:14 2015 +0300 +++ b/src/plugins/fts-solr/solr-connection.c Wed May 13 16:54:27 2015 +0300 @@ -497,18 +497,22 @@ if (post->failed) return; - if (http_client_request_send_payload(&post->http_req, data, size) != 0 && - conn->request_status < 0) + if (conn->request_status == 0) + (void)http_client_request_send_payload(&post->http_req, data, size); + if (conn->request_status < 0) post->failed = TRUE; } -int solr_connection_post_end(struct solr_connection_post *post) +int solr_connection_post_end(struct solr_connection_post **_post) { + struct solr_connection_post *post = *_post; struct solr_connection *conn = post->conn; int ret = post->failed ? -1 : 0; i_assert(conn->posting); + *_post = NULL; + if (!post->failed) { if (http_client_request_finish_payload(&post->http_req) <= 0 || conn->request_status < 0) {
--- a/src/plugins/fts-solr/solr-connection.h Wed May 13 16:46:14 2015 +0300 +++ b/src/plugins/fts-solr/solr-connection.h Wed May 13 16:54:27 2015 +0300 @@ -25,6 +25,6 @@ solr_connection_post_begin(struct solr_connection *conn); void solr_connection_post_more(struct solr_connection_post *post, const unsigned char *data, size_t size); -int solr_connection_post_end(struct solr_connection_post *post); +int solr_connection_post_end(struct solr_connection_post **post); #endif