]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: iostream-proxy - Add iostream_proxy_is_waiting_output()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 29 Oct 2017 21:53:16 +0000 (23:53 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Wed, 1 Nov 2017 00:23:31 +0000 (02:23 +0200)
src/lib/iostream-proxy.c
src/lib/iostream-proxy.h

index f2f49620a91d592057757620a4057b5d6d43e558..1b05163891cbfc4e8abbec62f2c83f6a2a3bc0fd 100644 (file)
@@ -124,6 +124,18 @@ void iostream_proxy_stop(struct iostream_proxy *proxy)
        iostream_pump_stop(proxy->rtl);
 }
 
+bool iostream_proxy_is_waiting_output(struct iostream_proxy *proxy,
+                                     enum iostream_proxy_side side)
+{
+       switch (side) {
+       case IOSTREAM_PROXY_SIDE_LEFT:
+               return iostream_pump_is_waiting_output(proxy->ltr);
+       case IOSTREAM_PROXY_SIDE_RIGHT:
+               return iostream_pump_is_waiting_output(proxy->rtl);
+       }
+       i_unreached();
+}
+
 void iostream_proxy_switch_ioloop(struct iostream_proxy *proxy)
 {
        i_assert(proxy != NULL);
index fc00fe3b4a5c042474f548e7e4cbba0cddfba9a0..6b290a6f2921119125da817d90208a5d4df4a142 100644 (file)
@@ -44,6 +44,10 @@ struct ostream *iostream_proxy_get_ostream(struct iostream_proxy *proxy, enum io
 void iostream_proxy_start(struct iostream_proxy *proxy);
 void iostream_proxy_stop(struct iostream_proxy *proxy);
 
+/* See iostream_pump_is_waiting_output() */
+bool iostream_proxy_is_waiting_output(struct iostream_proxy *proxy,
+                                     enum iostream_proxy_side side);
+
 void iostream_proxy_set_completion_callback(struct iostream_proxy *proxy,
                                       iostream_proxy_callback_t *callback, void *context);
 #define iostream_proxy_set_completion_callback(proxy, callback, context) \