io_new_conn_((ctx), (fd), \
typesafe_cb_preargs(struct io_plan *, void *, \
(init), (arg), \
- struct io_conn *conn), \
+ struct io_conn *), \
(void *)(arg))
struct io_conn *io_new_conn_(const tal_t *ctx, int fd,
* (tal'ocated off @ctx) and pass that to init(). Note that if there is
* an error on this file descriptor, it will be freed.
*
+ * Note: if the accept fails (usually due to EMFILE), init() will be called
+ * wth
* Returns NULL on error (and sets errno).
*
* Example:
* // Freed if conn closes normally.
* timeout = tal(conn, struct timeout_timer);
* timeout->conn = conn;
- * timeout->t = conn;
* timer_addrel(&timers, &timeout->t, time_from_sec(5));
* return io_sock_shutdown(conn);
* }
*/
int (*io_poll_override(int (*poll)(struct pollfd *fds, nfds_t nfds, int timeout)))(struct pollfd *, nfds_t, int);
+/**
+ * io_have_fd - do we own this file descriptor?
+ * @fd: the file descriptor.
+ * @listener: if non-NULL, set to true if it's a listening socket (io_listener).
+ *
+ * Returns NULL if we don't own it, otherwise a struct io_conn * or struct io_listener *.
+ */
+const void *io_have_fd(int fd, bool *listener);
+
+/**
+ * io_set_extended_errors - enable callbacks for errors.
+ * @state: true or false.
+ *
+ * Defaults false for compatibility. See io_new_conn for what this changes.
+ */
+void io_set_extended_errors(bool state);
+bool io_get_extended_errors(void);
+
#endif /* CCAN_IO_H */