Skip to content

Commit a51ed04

Browse files
authored
Merge pull request tronprotocol#856 from tronprotocol/p2p
mdf update both we have
2 parents 4015924 + ccc917d commit a51ed04

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/main/java/org/tron/common/overlay/server/SyncPool.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void init(PeerConnectionDelegate peerDel) {
106106
}
107107

108108
private void fillUp() {
109-
int lackSize = (int) (maxActiveNodes * fator) - activePeersCount.get();
109+
int lackSize = (int) (maxActiveNodes * fator) - activePeers.size();
110110
if(lackSize <= 0) return;
111111

112112
final Set<String> nodesInUse = channelManager.nodesInUse();
@@ -199,7 +199,7 @@ public synchronized void onDisconnect(Channel peer) {
199199
}
200200

201201
public boolean isCanConnect() {
202-
if (passivePeersCount.get() >= maxActiveNodes * (1 - fator)) {
202+
if (activePeers.size() >= maxActiveNodes) {
203203
return false;
204204
}
205205
return true;

‎src/main/java/org/tron/core/net/node/NodeImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ private void processAdvBlock(PeerConnection peer, BlockCapsule block) {
772772

773773
getActivePeer().stream()
774774
.filter(p -> p.getAdvObjSpreadToUs().containsKey(block.getBlockId()))
775-
.forEach(p -> updateBlockWeBothHave(peer, block));
775+
.forEach(p -> updateBlockWeBothHave(p, block));
776776

777777
broadcast(new BlockMessage(block));
778778

0 commit comments

Comments
 (0)