From: Timo Sirainen Date: Mon, 11 May 2020 15:50:18 +0000 (+0300) Subject: pop3: Minor optimization to unexpected client disconnections X-Git-Tag: 2.3.11.2~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6aae508da2b5153587aa2103364e065f19f13e99;p=thirdparty%2Fdovecot%2Fcore.git pop3: Minor optimization to unexpected client disconnections There's no need to build deleted messages seqset if it's not used. --- 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);