Pass peerdiscovery boolean to EthHandler

This commit is contained in:
nicksavers 2014-10-24 17:51:42 +02:00
parent 3613002557
commit aa204e3475
2 changed files with 11 additions and 14 deletions

View File

@ -1,6 +1,5 @@
package org.ethereum.net.eth; package org.ethereum.net.eth;
import com.sun.org.apache.xerces.internal.util.Status;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
import org.ethereum.core.Block; import org.ethereum.core.Block;
@ -54,16 +53,14 @@ public class EthHandler extends SimpleChannelInboundHandler<EthMessage> {
private boolean active = false; private boolean active = false;
private StatusMessage handshakeStatusMessage = null; private StatusMessage handshakeStatusMessage = null;
private boolean peerDiscovery = true; private boolean peerDiscoveryMode = false;
private Timer getBlocksTimer = new Timer("GetBlocksTimer"); private Timer getBlocksTimer = new Timer("GetBlocksTimer");
//
private Timer getTxTimer = new Timer("GetTransactionsTimer"); private Timer getTxTimer = new Timer("GetTransactionsTimer");
public EthHandler(MessageQueue msgQueue, PeerListener peerListener, boolean peerDiscovery) { public EthHandler(MessageQueue msgQueue, PeerListener peerListener, boolean peerDiscoveryMode) {
this.peerDiscovery = true; this.peerListener = peerListener;
this.peerDiscoveryMode = peerDiscoveryMode;
this.msgQueue = msgQueue; this.msgQueue = msgQueue;
} }
@ -165,7 +162,7 @@ public class EthHandler extends SimpleChannelInboundHandler<EthMessage> {
public void processStatus(StatusMessage msg, ChannelHandlerContext ctx) throws InterruptedException { public void processStatus(StatusMessage msg, ChannelHandlerContext ctx) throws InterruptedException {
this.handshakeStatusMessage = msg; this.handshakeStatusMessage = msg;
if (peerDiscovery) { if (peerDiscoveryMode) {
msgQueue.sendMessage(new DisconnectMessage(ReasonCode.REQUESTED)); msgQueue.sendMessage(new DisconnectMessage(ReasonCode.REQUESTED));
killTimers(); killTimers();
ctx.close().sync(); ctx.close().sync();

View File

@ -8,9 +8,9 @@ server.acceptConnections = false
peer.discovery.ip.list = poc-7.ethdev.com:30303,\ peer.discovery.ip.list = poc-7.ethdev.com:30303,\
54.204.10.41:30303 54.204.10.41:30303
# Peer Server Zero (poc-6.ethdev.com) # Peer Server Zero (poc-7.ethdev.com)
peer.active.ip = 185.43.109.23 #peer.active.ip = 207.12.89.180
peer.active.port = 30303 #peer.active.port = 30303
# ZeroGox # ZeroGox
@ -18,8 +18,8 @@ peer.active.port = 30303
#peer.active.port = 30303 #peer.active.port = 30303
# Winslave # Winslave
#peer.active.ip = 185.43.109.23 peer.active.ip = 185.43.109.23
#peer.active.port = 30303 peer.active.port = 30303
# Mist # Mist
#peer.active.ip = 213.46.28.223 #peer.active.ip = 213.46.28.223
@ -44,7 +44,7 @@ protocol.version = 33
# the peer window will show # the peer window will show
# only what retrieved by active # only what retrieved by active
# peer [true/false] # peer [true/false]
peer.discovery = true peer.discovery = false
# number of workers that # number of workers that
# tastes the peers for being # tastes the peers for being