Commit c4e6bf0e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make sundry time values be unsigned.

parent 7e04f06d
......@@ -491,7 +491,7 @@ flushbuf(struct network *net)
static void
schedule_flush(struct network *net)
{
int msecs = jitter(net, 0);
unsigned msecs = jitter(net, 0);
if(net->flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&net->flush_timeout, &now) < msecs)
return;
......@@ -504,7 +504,7 @@ static void
schedule_flush_now(struct network *net)
{
/* Almost now */
int msecs = roughly(10);
unsigned msecs = roughly(10);
if(net->flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&net->flush_timeout, &now) < msecs)
return;
......@@ -514,12 +514,10 @@ schedule_flush_now(struct network *net)
}
static void
schedule_unicast_flush(int msecs)
schedule_unicast_flush(unsigned msecs)
{
if(!unicast_neighbour)
return;
if(msecs < 0)
msecs = jitter(unicast_neighbour->network, 1);
if(unicast_flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&unicast_flush_timeout, &now) < msecs)
return;
......@@ -926,7 +924,7 @@ flushupdates(void)
static void
schedule_update_flush(struct network *net, int urgent)
{
int msecs;
unsigned msecs;
msecs = update_jitter(net, urgent);
if(update_flush_timeout.tv_sec != 0 &&
timeval_minus_msec(&update_flush_timeout, &now) < msecs)
......
......@@ -198,7 +198,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
static int
reset_txcost(struct neighbour *neigh)
{
int delay;
unsigned delay;
delay = timeval_minus_msec(&now, &neigh->ihu_time);
......@@ -228,8 +228,8 @@ unsigned
check_neighbours()
{
struct neighbour *neigh;
int changed, delay;
int msecs = 50000;
int changed;
unsigned msecs = 50000, delay;
debugf("Checking neighbours.\n");
......@@ -268,7 +268,7 @@ check_neighbours()
unsigned
neighbour_rxcost(struct neighbour *neigh)
{
int delay;
unsigned delay;
unsigned short reach = neigh->reach;
delay = timeval_minus_msec(&now, &neigh->hello_time);
......
......@@ -114,7 +114,7 @@ update_hello_interval(struct network *net)
/* This should be no more than half the hello interval, so that hellos
aren't sent late. The result is in milliseconds. */
unsigned int
unsigned
jitter(struct network *net, int urgent)
{
unsigned interval = net->hello_interval;
......@@ -125,7 +125,7 @@ jitter(struct network *net, int urgent)
return roughly(interval) / 4;
}
unsigned int
unsigned
update_jitter(struct network *net, int urgent)
{
unsigned interval = net->hello_interval;
......
......@@ -63,8 +63,8 @@ extern int numnets;
struct network *add_network(char *ifname);
int network_idle(struct network *net);
int update_hello_interval(struct network *net);
unsigned int jitter(struct network *net, int urgent);
unsigned int update_jitter(struct network *net, int urgent);
unsigned jitter(struct network *net, int urgent);
unsigned update_jitter(struct network *net, int urgent);
void delay_jitter(struct timeval *time, struct timeval *timeout, int msecs);
int network_up(struct network *net, int up);
int network_ll_address(struct network *net, const unsigned char *address);
......
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