Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Remove WorldManager dependency from PeerConnectionTester
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev committed Sep 6, 2016
1 parent a44b39e commit 39ad7af
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.commons.codec.binary.Hex;
import org.ethereum.config.SystemProperties;
import org.ethereum.manager.WorldManager;
import org.ethereum.net.client.PeerClient;
import org.ethereum.net.rlpx.Node;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
Expand All @@ -28,7 +29,7 @@ public class PeerConnectionTester {
private long ReconnectMaxPeers;

@Autowired
private WorldManager worldManager;
private ApplicationContext ctx;

@Autowired
SystemProperties config = SystemProperties.getDefault();
Expand Down Expand Up @@ -56,7 +57,8 @@ public void run() {
nodeHandler.getNodeStatistics().rlpxConnectionAttempts.add();
logger.debug("Trying node connection: " + nodeHandler);
Node node = nodeHandler.getNode();
worldManager.getActivePeer().connect(node.getHost(), node.getPort(),
PeerClient peerClient = ctx.getBean(PeerClient.class);
peerClient.connect(node.getHost(), node.getPort(),
Hex.encodeHexString(node.getId()), true);
logger.debug("Terminated node connection: " + nodeHandler);
nodeHandler.getNodeStatistics().disconnected();
Expand Down

0 comments on commit 39ad7af

Please sign in to comment.