You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I am using & learning horst recently.But I found that the main display window never delete PR after timeout, I enable WIFI on my phone, then disable WIFI when I see it on display window, and wait for 60 sec, my phone mac address is still there.
I dig into the code and found something. It will delete node info using the code: // node.c node_timeout() if (n->last_seen < (the_time.tv_sec - conf.node_timeout)) { //... }
last_seen is timestamp of the node: // node.c copy_nodeinfo() n->last_seen = time(NULL);
the_time is current time: clock_gettime(CLOCK_MONOTONIC, &the_time);
But, the_time.tv_sec is always smaller then n->last_seen, so it will not delete node info.
When I change clock_gettime(CLOCK_MONOTONIC, &the_time);
to clock_gettime(CLOCK_REALTIME, &the_time);
everything is OK.
Is there something wrong or just my misunderstanding of horst?
Thanks!
The text was updated successfully, but these errors were encountered:
Yes, this was a bug and it's fixed in the 'stable' branch now. I will make a new 5.1 release once more bugfixes accumulate.
The mistake was to use the time() function instead of monotonic time. Monotonic time is better for dealing with timeouts, since it's unaffected by local time changes (either by NTP or manually).
Thank you for reply.
I think the following code will need to fix too: struct tm* ltm = localtime(&the_time.tv_sec);
in write_to_file() of main.c.
because the_time.tv_sec is not the 'real time'.
Hi! I am using & learning horst recently.But I found that the main display window never delete PR after timeout, I enable WIFI on my phone, then disable WIFI when I see it on display window, and wait for 60 sec, my phone mac address is still there.
I dig into the code and found something. It will delete node info using the code:
// node.c node_timeout() if (n->last_seen < (the_time.tv_sec - conf.node_timeout)) { //... }
last_seen is timestamp of the node:
// node.c copy_nodeinfo() n->last_seen = time(NULL);
the_time is current time:
clock_gettime(CLOCK_MONOTONIC, &the_time);
But, the_time.tv_sec is always smaller then n->last_seen, so it will not delete node info.
When I change
clock_gettime(CLOCK_MONOTONIC, &the_time);
to
clock_gettime(CLOCK_REALTIME, &the_time);
everything is OK.
Is there something wrong or just my misunderstanding of horst?
Thanks!
The text was updated successfully, but these errors were encountered: