Commit f43f748f authored by Niels Möller's avatar Niels Möller

Added STATIC_HEADER to non-heap allocated objects.Initialize the

on_hold field properly.

Rev: src/io.c:1.12
parent 553c8532
...@@ -53,6 +53,8 @@ static int do_read(struct abstract_read **r, UINT32 length, UINT8 *buffer) ...@@ -53,6 +53,8 @@ static int do_read(struct abstract_read **r, UINT32 length, UINT8 *buffer)
struct fd_read *closure struct fd_read *closure
= (struct fd_read *) *r; = (struct fd_read *) *r;
MDEBUG(closure);
while(1) while(1)
{ {
int res = read(closure->fd, buffer, length); int res = read(closure->fd, buffer, length);
...@@ -205,8 +207,8 @@ static int io_iter(struct io_backend *b) ...@@ -205,8 +207,8 @@ static int io_iter(struct io_backend *b)
break; break;
} }
else if (!res) // else if (!res)
fatal("What now?"); // fatal("What now?");
else else
fd->buffer->start += res; fd->buffer->start += res;
} }
...@@ -221,7 +223,7 @@ static int io_iter(struct io_backend *b) ...@@ -221,7 +223,7 @@ static int io_iter(struct io_backend *b)
&& (fds[i].revents & POLLIN)) && (fds[i].revents & POLLIN))
{ {
struct fd_read r = struct fd_read r =
{ { do_read }, fd->fd }; { { STATIC_HEADER do_read }, fd->fd };
/* The handler function may install a new handler */ /* The handler function may install a new handler */
if (!READ_HANDLER(fd->handler, if (!READ_HANDLER(fd->handler,
...@@ -474,10 +476,14 @@ struct abstract_write *io_read_write(struct io_backend *b, ...@@ -474,10 +476,14 @@ struct abstract_write *io_read_write(struct io_backend *b,
f->fd = fd; f->fd = fd;
f->please_close = 0; f->please_close = 0;
/* Reading */
f->handler = read_callback; f->handler = read_callback;
f->close_callback = close_callback; f->on_hold = 0;
/* Writing */
f->buffer = buffer; f->buffer = buffer;
f->close_callback = close_callback;
f->next = b->io; f->next = b->io;
b->io = f; b->io = f;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment