PeerDiscovery - minor cleanup
This commit is contained in:
parent
aeec38085b
commit
0990a0717a
|
@ -46,7 +46,6 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter {
|
|||
|
||||
private final Timer timer = new Timer();
|
||||
|
||||
private long lastPongTime = 0;
|
||||
private boolean tearDown = false;
|
||||
|
||||
private PeerListener peerListener;
|
||||
|
@ -73,17 +72,7 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter {
|
|||
|
||||
public void run() {
|
||||
|
||||
if (lastPongTime == 0) lastPongTime = System.currentTimeMillis();
|
||||
if (tearDown) this.cancel();
|
||||
|
||||
/* todo: temporary cancel ping rate test
|
||||
long currTime = System.currentTimeMillis();
|
||||
if (currTime - lastPongTime > 30000) {
|
||||
logger.info("No ping answer for [30 sec]");
|
||||
throw new RuntimeException("No ping return for 30 [sec]");
|
||||
}
|
||||
*/
|
||||
|
||||
sendPing();
|
||||
}
|
||||
}, 2000, 5000);
|
||||
|
@ -166,7 +155,6 @@ public class EthereumProtocolHandler extends ChannelInboundHandlerAdapter {
|
|||
// got PONG mark it
|
||||
if (Command.fromInt(command) == PONG) {
|
||||
if (peerListener != null) peerListener.console("[Recv: PONG]");
|
||||
this.lastPongTime = System.currentTimeMillis();
|
||||
msgQueue.receivedMessage(PONG_MESSAGE);
|
||||
|
||||
if (listener != null)
|
||||
|
|
|
@ -5,11 +5,13 @@ import io.netty.channel.ChannelHandlerContext;
|
|||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.FixedRecvByteBufAllocator;
|
||||
|
||||
import org.ethereum.manager.WorldManager;
|
||||
import org.ethereum.net.Command;
|
||||
import org.ethereum.net.PeerListener;
|
||||
import org.ethereum.net.message.*;
|
||||
import org.ethereum.net.message.DisconnectMessage;
|
||||
import org.ethereum.net.message.HelloMessage;
|
||||
import org.ethereum.net.message.PeersMessage;
|
||||
import org.ethereum.net.message.StaticMessages;
|
||||
import org.ethereum.util.ByteUtil;
|
||||
import org.ethereum.util.RLP;
|
||||
import org.ethereum.util.RLPList;
|
||||
|
@ -17,9 +19,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static org.ethereum.net.Command.*;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue