Use libevent to dump graphs when necessary.
event_add() can be called repeatedly, the second and later calls are ignored if the event hasn't been removed yet.
This commit is contained in:
parent
0f6f54ff8a
commit
4d0621b1f3
2 changed files with 15 additions and 24 deletions
10
src/net.c
10
src/net.c
|
|
@ -301,7 +301,7 @@ int main_loop(void)
|
|||
{
|
||||
struct timeval tv;
|
||||
int r;
|
||||
time_t last_ping_check, last_config_check, last_graph_dump;
|
||||
time_t last_ping_check, last_config_check;
|
||||
tevent_t *event;
|
||||
struct event timeout;
|
||||
|
||||
|
|
@ -309,7 +309,6 @@ int main_loop(void)
|
|||
|
||||
last_ping_check = now;
|
||||
last_config_check = now;
|
||||
last_graph_dump = now;
|
||||
|
||||
srand(now);
|
||||
|
||||
|
|
@ -431,13 +430,6 @@ int main_loop(void)
|
|||
|
||||
try_outgoing_connections();
|
||||
}
|
||||
|
||||
/* Dump graph if wanted every 60 seconds*/
|
||||
|
||||
if(last_graph_dump + 60 < now) {
|
||||
dump_graph();
|
||||
last_graph_dump = now;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue