]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: connection: Allow switching to a specific ioloop.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 17 Jan 2018 01:50:05 +0000 (02:50 +0100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 30 Jan 2018 21:19:19 +0000 (23:19 +0200)
src/lib/connection.c
src/lib/connection.h

index f2d54efcaacc97539c1c1b23d4e11af62680173c..80236f99a0b8788a8727be781225f4d85c2cd41a 100644 (file)
@@ -416,16 +416,22 @@ const char *connection_input_timeout_reason(struct connection *conn)
        }
 }
 
-void connection_switch_ioloop(struct connection *conn)
+void connection_switch_ioloop_to(struct connection *conn,
+                                struct ioloop *ioloop)
 {
        if (conn->io != NULL)
-               conn->io = io_loop_move_io(&conn->io);
+               conn->io = io_loop_move_io_to(ioloop, &conn->io);
        if (conn->to != NULL)
-               conn->to = io_loop_move_timeout(&conn->to);
+               conn->to = io_loop_move_timeout_to(ioloop, &conn->to);
        if (conn->input != NULL)
-               i_stream_switch_ioloop(conn->input);
+               i_stream_switch_ioloop_to(conn->input, ioloop);
        if (conn->output != NULL)
-               o_stream_switch_ioloop(conn->output);
+               o_stream_switch_ioloop_to(conn->output, ioloop);
+}
+
+void connection_switch_ioloop(struct connection *conn)
+{
+       connection_switch_ioloop_to(conn, current_ioloop);
 }
 
 struct connection_list *
index 70dc2f24a5172ebc35034da8a434b87a0aa34b21..36fe6582d0c456eb2ac6c3476d8bcac2c38434b7 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "net.h"
 
+struct ioloop;
 struct connection;
 
 enum connection_behavior {
@@ -141,6 +142,8 @@ const char *connection_disconnect_reason(struct connection *conn);
    e.g. "No input for 10.023 secs". */
 const char *connection_input_timeout_reason(struct connection *conn);
 
+void connection_switch_ioloop_to(struct connection *conn,
+                                struct ioloop *ioloop);
 void connection_switch_ioloop(struct connection *conn);
 
 struct connection_list *