Skip to content

Commit 1921ceb

Browse files
committed
Fix geodata save if only new peers
1 parent 4e00da7 commit 1921ceb

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/Utility.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ function createPeersGeo($peerinfo){
483483

484484
// Check if peer file exists and enabled
485485
if (file_exists('data/geodatapeers.inc')){
486-
print_r("geodatafile exists");
487486
// Loads serialized stored peers from disk
488487
$serializedPeers = file_get_contents('data/geodatapeers.inc');
489488
$arrayPeers = unserialize($serializedPeers);
@@ -565,10 +564,8 @@ function createPeersGeo($peerinfo){
565564
$region = "New";
566565
$city = "New";
567566
$isp = "New";
568-
$hosted = false;
569-
567+
$hosted = false;
570568
}
571-
572569
}else{
573570
$id = $peerObj->id;
574571
// Nodes that we know about but reconnected
@@ -615,15 +612,18 @@ function createPeersGeo($peerinfo){
615612

616613
}
617614

618-
// Removes all peers that the node is not connected to anymore.
619-
foreach($arrayPeers as $key => $peer){
620-
if($peer[7] == 0){
621-
unset($arrayPeers[$key]);
615+
// Only if new peers connected
616+
if(isset($ipData)) {
617+
// Removes all peers that the node is not connected to anymore.
618+
foreach($arrayPeers as $key => $peer){
619+
if($peer[7] == 0){
620+
unset($arrayPeers[$key]);
621+
}
622622
}
623-
}
624623

625-
$newSerializePeers = serialize($arrayPeers);
626-
file_put_contents('data/geodatapeers.inc', $newSerializePeers);
624+
$newSerializePeers = serialize($arrayPeers);
625+
file_put_contents('data/geodatapeers.inc', $newSerializePeers);
626+
}
627627

628628
return $peersInfo;
629629
}

views/main.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,11 @@
209209
<div class="x_title">
210210
<h2>Global Peer Distribution</h2>
211211
<ul class="nav navbar-right panel_toolbox">
212+
212213
<li><a class="close-link"><i class="fa fa-close"></i></a>
213214
</li><li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
215+
<li><a><i class="fa fa-question-circle-o" data-toggle="tooltip" data-html="true" data-placement="left" title="BNM will only check the country/isp for peers that are older than 2 minutes."></i></a>
216+
</li>
214217
</li>
215218

216219
</ul>

0 commit comments

Comments
 (0)