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

Made a new funtion, io_iter, for the contents of the io_run loop.

Rev: src/io.c:1.11
parent d072255f
......@@ -89,10 +89,8 @@ static int do_read(struct abstract_read **r, UINT32 length, UINT8 *buffer)
/* UNLINK_FD must be followed by a continue, to avoid updating _fd */
#define UNLINK_FD (*_fd = (*_fd)->next)
void io_run(struct io_backend *b)
static int io_iter(struct io_backend *b)
{
while(1)
{
struct pollfd *fds;
int i;
unsigned long nfds; /* FIXME: Should be nfds_t if that type is defined */
......@@ -118,7 +116,7 @@ void io_run(struct io_backend *b)
{
if (!nfds)
/* All done */
break;
return 0;
timeout = -1;
}
......@@ -129,7 +127,7 @@ void io_run(struct io_backend *b)
FOR_FDS(struct io_fd, fd, b->io, i++)
{
fds[i].fd = fd->on_hold ? -1 : fd->fd;
fds[i].fd = fd->fd;
fds[i].events = 0;
if (!fd->on_hold)
fds[i].events |= POLLIN;
......@@ -172,7 +170,7 @@ void io_run(struct io_backend *b)
{
case EAGAIN:
case EINTR:
continue;
return 1;
default:
fatal("io_run:poll failed: %s", strerror(errno));
}
......@@ -295,13 +293,19 @@ void io_run(struct io_backend *b)
}
END_FOR_FDS;
}
}
return 1;
}
void io_run(struct io_backend *b)
{
while(io_iter(b))
;
}
/*
* Fill in ADDR from HOST, SERVICE and PROTOCOL.
* Supplying a null pointer for HOST means use INADDR_ANY.
* Otherwise HOST is an numbers-and-dits ip-number or a dns name.
* Otherwise HOST is an numbers-and-dots ip-number or a dns name.
*
* PROTOCOL can be tcp or udp.
*
......
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