diff options
| author | Anton <anton@picapica> | 2019-03-15 19:37:08 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2019-03-15 19:37:08 +0400 |
| commit | 8efba55c86e0437ae65e0b0f5ab7271956265a8d (patch) | |
| tree | be126bdfbab869ed2ff71bb05f41c66b883de9f3 /PICA_node.c | |
| parent | ad5b7d28c53bfbc88f8dbe898114ff459448c5f4 (diff) | |
| download | pica-pica-8efba55c86e0437ae65e0b0f5ab7271956265a8d.tar.gz pica-pica-8efba55c86e0437ae65e0b0f5ab7271956265a8d.zip | |
pica-node: implement cleaning inactive nodes
Diffstat (limited to 'PICA_node.c')
| -rw-r--r-- | PICA_node.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/PICA_node.c b/PICA_node.c index a8810d4..574aa9b 100644 --- a/PICA_node.c +++ b/PICA_node.c @@ -2592,7 +2592,19 @@ int process_timeouts() if (time(0) - skynet_refresh_tmst > SKYNET_REFRESH_TIMEOUT && !nodewait_list) { + int clean_treshold = 100 - nodelink_list_count - cclink_list_count; + + if (clean_treshold <= 0) + clean_treshold = 3; + PICA_debug3("refreshing nodelist database"); + + if (nodelink_list_count > 0) + { + PICA_debug3("trying to clean nodes unreachable after more than %i attempts", clean_treshold); + PICA_nodeaddr_cleanold(nodecfg.nodes_db_file, clean_treshold); + } + PICA_node_joinskynet(nodecfg.nodes_db_file, nodecfg.announced_addr); } return 1; |
