From: Marco Bettini Date: Wed, 1 Mar 2023 14:18:34 +0000 (+0000) Subject: fts: fts_indexer_input_args() - Fix client-side timeout X-Git-Tag: 2.4.0~2736 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace7cbd3f94493d2926e4fa94701af7d31ebb3a8;p=thirdparty%2Fdovecot%2Fcore.git fts: fts_indexer_input_args() - Fix client-side timeout Client side timeout now just triggers if there is period long enough where the server doesn't send updates. This works just because the server is not pushing the updates properly. The client must timeout BOTH if the server is unresponsive AND if the server sends updates but the overall elapsed time exceedes. --- diff --git a/src/plugins/fts/fts-indexer.c b/src/plugins/fts/fts-indexer.c index 79d4a4d7af..4372ab8108 100644 --- a/src/plugins/fts/fts-indexer.c +++ b/src/plugins/fts/fts-indexer.c @@ -34,6 +34,8 @@ struct fts_indexer_context { bool completed:1; }; +static void fts_indexer_idle_timeout(struct connection *conn); + static void fts_indexer_notify(struct fts_indexer_context *ctx) { unsigned long long elapsed_msecs, est_total_msecs; @@ -167,8 +169,14 @@ fts_indexer_input_args(struct connection *conn, const char *const *args) return -1; } ctx->percentage = percentage; + time_t elapsed = ioloop_time - ctx->search_start_time.tv_sec; if (ctx->percentage == 100) ctx->completed = TRUE; + else if (ctx->conn.input_idle_timeout_secs > 0 && + elapsed > ctx->conn.input_idle_timeout_secs) { + fts_indexer_idle_timeout(&ctx->conn); + return -1; + } return 1; }