There is some trailing whitespace in the man page.
I find it marginally easier to read do-while loops when they are
followed by a newline. If you disagree then leave it.
> + fds = xmalloc((local_max_port - local_min_port) * sizeof *fds);
I think you want (1 + local_max_port - local_min_port).
> + if (newfd >= 0) {
> + close(newfd);
> + } else if (errno != EAGAIN) {
> + ovs_fatal(errno, "accept failed");
> + }
> +
Redundant newline.
> +static void
> +next_ports(unsigned short int *local_port, unsigned short int *remote_port)
> +{
> + if ((*local_port)++ == local_max_port) {
> + *local_port = local_min_port;
> + if ((*remote_port)++ == remote_max_port) {
> + *remote_port = remote_min_port;
> + }
> + }
> +}
I found this function difficult to read. Maybe something like this
would be more obviously correct?
static void
next_ports(unsigned short int *local_port, unsigned short int *remote_port)
{
if (*local_port >= local_max_port) {
*local_port = local_min_port;
if (*remote_port >= remote_max_port) {
*remote_port = remote_min_port;
} else {
(*remote_port)++;
}
} else {
(*local_port)++;
}
}
If you disagree, leave it.
Looks good, seems like a nifty utility.
Ethan
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev