]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH 1/5] imap: Extract side-channel ostream creation into helper
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 1 May 2026 17:40:08 +0000 (17:40 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
Add client_create_side_channel_output() and use it in cmd_compress()
in place of the inline channel-creation code. The helper will also be
used by the imap state import path to recreate the side channel after
unhibernation. No functional change.

Gbp-Pq: Name 0001-imap-Extract-side-channel-ostream-creation-into-help.patch

src/imap/cmd-compress.c
src/imap/imap-client.c
src/imap/imap-client.h

index 363d050f474379c389e0570bc589ab504f299010..18aa988892b07834df417ae6d30d504562f2c401 100644 (file)
@@ -4,7 +4,6 @@
 #include "imap-commands.h"
 #include "istream.h"
 #include "ostream.h"
-#include "ostream-multiplex.h"
 #include "iostream-rawlog.h"
 #include "str.h"
 #include "strescape.h"
@@ -92,13 +91,8 @@ bool cmd_compress(struct client_command_context *cmd)
                /* Let imap-login process handle the COMPRESS. It's the one
                   that will send the tagged reply to the client. */
                client->compress_handler = handler;
-               if (client->side_channel_output == NULL) {
-                       client->side_channel_output =
-                               o_stream_multiplex_add_channel(
-                                       client->multiplex_output, 1);
-                       o_stream_set_no_error_handling(
-                               client->side_channel_output, TRUE);
-               }
+               if (client->side_channel_output == NULL)
+                       client_create_side_channel_output(client);
                string_t *str = t_str_new(64);
                str_append(str, "compress\t");
                str_append_tabescaped(str, handler->name);
index f8704ba3094836f4dcbc45353f71c3c9f3dfd228..3de93917937ca35b26dc85183f9a25d9010b1b3f 100644 (file)
@@ -678,6 +678,15 @@ void client_send_tagline(struct client_command_context *cmd, const char *data)
        cmd->client->v.send_tagline(cmd, data);
 }
 
+void client_create_side_channel_output(struct client *client)
+{
+       i_assert(client->multiplex_output != NULL);
+       i_assert(client->side_channel_output == NULL);
+       client->side_channel_output =
+               o_stream_multiplex_add_channel(client->multiplex_output, 1);
+       o_stream_set_no_error_handling(client->side_channel_output, TRUE);
+}
+
 static void
 client_default_send_tagline(struct client_command_context *cmd, const char *data)
 {
index fd1153d97fb06a4464d73e92cd33c1ef414e80a6..a4f2e4f3fb379dc08d01b1c0ea711a5a2f0c1aa8 100644 (file)
@@ -287,6 +287,11 @@ void client_add_istream_prefix(struct client *client,
                               const unsigned char *data, size_t size);
 void client_destroy(struct client *client, const char *reason) ATTR_NULL(2);
 
+/* Add the side-channel ostream used to send commands (e.g. dict_reset) back
+   to the imap-login proxy. Must only be called when multiplex_output is set
+   and the channel hasn't been created yet. */
+void client_create_side_channel_output(struct client *client);
+
 /* Disconnect client connection */
 void client_disconnect(struct client *client, const char *reason);
 void client_disconnect_with_error(struct client *client,