1 #include <ccan/io/io.h>
2 /* Include the C files directly. */
3 #include <ccan/io/poll.c>
4 #include <ccan/io/io.c>
5 #include <ccan/tap/tap.h>
11 static struct io_plan timeout_wakeup(struct io_conn *conn, char *buf)
13 /* This kills the dummy connection. */
15 return io_read(buf, 16, io_close, NULL);
28 /* Write then close. */
29 io_new_conn(fds[1], io_write("hello there world", 16, io_close, NULL),
31 conn = io_new_conn(fds[0], io_idle(), NULL, NULL);
33 /* To avoid assert(num_waiting) */
35 io_new_conn(fds2[0], io_read(buf, 16, io_close, NULL), NULL, NULL);
37 /* After half a second, it will read. */
38 io_timeout(conn, time_from_msec(500), timeout_wakeup, buf);
40 ok1(io_loop() == NULL);
41 ok1(memcmp(buf, "hello there world", 16) == 0);
43 /* This exits depending on whether all tests passed */