X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fio.h;h=558a8769e1428355c254af670790d01f5ccda09e;hp=df0764bd17e1ff7f50633ffe91a45de4c02c6a22;hb=95b59482c1bb18b7904ea60149eff4809dd28d80;hpb=02ae136a997a5e7cc3bb9210167a066b9f169a7b diff --git a/ccan/io/io.h b/ccan/io/io.h index df0764bd..558a8769 100644 --- a/ccan/io/io.h +++ b/ccan/io/io.h @@ -394,7 +394,7 @@ bool io_timeout_(struct io_conn *conn, struct timespec ts, * to have two connections for the same fd, and use one for read * operations and one for write. * - * Returning io_close() on one will close both fds! + * You must io_close() both of them to close the fd. * * Example: * static void setup_read_write(int fd, @@ -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. *