]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/io.h
io: handle duplex corner cases.
[ccan] / ccan / io / io.h
index 067a69c1dec441a752508dfe50ee8f83b8421466..0318aef300873fa71104e0a2b630ad28e93e7065 100644 (file)
@@ -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.
  *
- * You must io_close() both of them to close the fd.
+ * Returning io_close() on one will close both fds!
  *
  * Example:
  *     static void setup_read_write(int fd,
@@ -491,6 +491,14 @@ struct io_plan io_close_cb(struct io_conn *, void *unused);
  */
 void *io_loop(void);
 
+/**
+ * io_conn_fd - get the fd from a connection.
+ * @conn: the connection.
+ *
+ * Sometimes useful, eg for getsockname().
+ */
+int io_conn_fd(const struct io_conn *conn);
+
 /**
  * io_set_alloc - set alloc/realloc/free function for io to use.
  * @allocfn: allocator function