X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Fio.h;h=558a8769e1428355c254af670790d01f5ccda09e;hb=95b59482c1bb18b7904ea60149eff4809dd28d80;hp=4468cee3ab0d10d14aacd6cc3cfa3462bc8ec114;hpb=f508ed408b230c21341778370ab04def8e7aba3a;p=ccan diff --git a/ccan/io/io.h b/ccan/io/io.h index 4468cee3..558a8769 100644 --- a/ccan/io/io.h +++ b/ccan/io/io.h @@ -495,6 +495,24 @@ struct io_plan io_close_(void); */ struct io_plan io_close_cb(struct io_conn *, void *unused); +/** + * io_close_other - close different connection next time around the I/O loop. + * @conn: the connection to close. + * + * This is used to force a different connection to close: no more I/O will + * happen on @conn, even if it's pending. + * + * It's a bug to use this on the current connection! + * + * Example: + * static void stop_connection(struct io_conn *conn) + * { + * printf("forcing stop on connection\n"); + * io_close_other(conn); + * } + */ +void io_close_other(struct io_conn *conn); + /** * io_loop - process fds until all closed on io_break. *