mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Send monitor announcement based on reachability change instead of routing calcs
This commit is contained in:
parent
ed8be33f82
commit
542a9f817d
@ -194,6 +194,7 @@ int subscriber_is_reachable(struct subscriber *subscriber){
|
||||
int set_reachable(struct subscriber *subscriber, int reachable){
|
||||
if (subscriber->reachable==reachable)
|
||||
return 0;
|
||||
int old_value = subscriber->reachable;
|
||||
subscriber->reachable=reachable;
|
||||
|
||||
// These log messages are for use in tests. Changing them may break test scripts.
|
||||
@ -232,6 +233,11 @@ int set_reachable(struct subscriber *subscriber, int reachable){
|
||||
if (subscriber==directory_service)
|
||||
directory_registration();
|
||||
|
||||
if ((old_value & REACHABLE) && (!(reachable & REACHABLE)))
|
||||
monitor_announce_unreachable_peer(subscriber->sid);
|
||||
if ((!(old_value & REACHABLE)) && (reachable & REACHABLE))
|
||||
monitor_announce_peer(subscriber->sid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -527,12 +527,10 @@ int overlay_route_recalc_node_metrics(overlay_node *n, time_ms_t now)
|
||||
|
||||
if (old_best && !best_score){
|
||||
INFOF("PEER UNREACHABLE, sid=%s", alloca_tohex_sid(n->subscriber->sid));
|
||||
monitor_announce_unreachable_peer(n->subscriber->sid);
|
||||
}else if(best_score && !old_best){
|
||||
INFOF("PEER REACHABLE, sid=%s", alloca_tohex_sid(n->subscriber->sid));
|
||||
/* Make sure node is advertised soon */
|
||||
overlay_route_please_advertise(n);
|
||||
monitor_announce_peer(n->subscriber->sid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user