X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fbenchmarks%2Frun-length-prefix.c;h=2ed9c72933f18d9a15a01f2c711752d0a103e61e;hp=8a276839395223dfb403db4e5102b9d4c6eae890;hb=625bae8f5720d3ad3253ea9b26ad68abcd81bde5;hpb=7a8a585c32d1010426f587a6933f05de7a06dfd0 diff --git a/ccan/io/benchmarks/run-length-prefix.c b/ccan/io/benchmarks/run-length-prefix.c index 8a276839..2ed9c729 100644 --- a/ccan/io/benchmarks/run-length-prefix.c +++ b/ccan/io/benchmarks/run-length-prefix.c @@ -25,31 +25,31 @@ struct client { char *request_buffer; }; -static struct io_plan *write_reply(struct io_conn *conn, struct client *client); -static struct io_plan *read_body(struct io_conn *conn, struct client *client) +static struct io_plan write_reply(struct io_conn *conn, struct client *client); +static struct io_plan read_body(struct io_conn *conn, struct client *client) { assert(client->len <= REQUEST_MAX); - return io_read(client->request_buffer, client->len, - io_next(conn, write_reply, client)); + return io_read(conn, client->request_buffer, client->len, + write_reply, client); } -static struct io_plan *read_header(struct io_conn *conn, struct client *client) +static struct io_plan read_header(struct io_conn *conn, struct client *client) { - return io_read(&client->len, sizeof(client->len), - io_next(conn, read_body, client)); + return io_read(conn, &client->len, sizeof(client->len), + read_body, client); } /* once we're done, loop again. */ -static struct io_plan *write_complete(struct io_conn *conn, struct client *client) +static struct io_plan write_complete(struct io_conn *conn, struct client *client) { completed++; return read_header(conn, client); } -static struct io_plan *write_reply(struct io_conn *conn, struct client *client) +static struct io_plan write_reply(struct io_conn *conn, struct client *client) { - return io_write(&client->len, sizeof(client->len), - io_next(conn, write_complete, client)); + return io_write(conn, &client->len, sizeof(client->len), + write_complete, client); } /* This runs in the child. */ @@ -112,14 +112,14 @@ static void sigalarm(int sig) write(timeout[1], "1", 1); } -static struct io_plan *do_timeout(struct io_conn *conn, char *buf) +static struct io_plan do_timeout(struct io_conn *conn, char *buf) { - return io_break(conn, NULL); + return io_break(conn, buf, NULL, NULL); } -static struct io_plan *do_timeout_read(struct io_conn *conn, char *buf) +static struct io_plan do_timeout_read(struct io_conn *conn, char *buf) { - return io_read(buf, 1, io_next(conn, do_timeout, buf)); + return io_read(conn, buf, 1, do_timeout, buf); } int main(int argc, char *argv[])