From 74e4a36df897582cde5549c707f87209aa4e4759 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 11 May 2020 18:50:18 +0300 Subject: [PATCH] pop3: Minor optimization to unexpected client disconnections There's no need to build deleted messages seqset if it's not used. --- src/pop3/pop3-commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pop3/pop3-commands.c b/src/pop3/pop3-commands.c index dcbced3589..4c0efa5e3f 100644 --- a/src/pop3/pop3-commands.c +++ b/src/pop3/pop3-commands.c @@ -247,7 +247,7 @@ bool client_update_mails(struct client *client) /* translate msgnums to sequences (in case POP3 ordering is different) */ t_array_init(&deleted_msgs, 8); - if (client->deleted_bitmask != NULL) { + if (client->deleted_bitmask != NULL && client->quit_seen) { for (msgnum = 0; msgnum < client->messages_count; msgnum++) { bit = 1 << (msgnum % CHAR_BIT); if ((client->deleted_bitmask[msgnum / CHAR_BIT] & bit) != 0) @@ -268,7 +268,7 @@ bool client_update_mails(struct client *client) mail_search_args_unref(&search_args); while (mailbox_search_next(ctx, &mail)) { - if (client->quit_seen && seq_range_exists(&deleted_msgs, mail->seq)) + if (seq_range_exists(&deleted_msgs, mail->seq)) client_expunge(client, mail); else if (seq_range_exists(&seen_msgs, mail->seq)) mail_update_flags(mail, MODIFY_ADD, MAIL_SEEN); -- 2.47.3