update geet-peers new spec requirement

This commit is contained in:
romanman 2014-10-29 15:17:14 -05:00
parent 5f413d0ffb
commit e487f3475f
3 changed files with 14 additions and 6 deletions

View File

@ -24,7 +24,7 @@ public class GetPeersMessage extends P2pMessage {
@Override
public Class<PeersMessage> getAnswerMessage() {
return PeersMessage.class;
return null;
}
@Override

View File

@ -56,6 +56,7 @@ public class P2pHandler extends SimpleChannelInboundHandler<P2pMessage> {
private boolean peerDiscoveryMode = false;
private HelloMessage handshakeHelloMessage = null;
private Set<PeerInfo> lastPeersSent;
public P2pHandler() {
}
@ -150,14 +151,21 @@ public class P2pHandler extends SimpleChannelInboundHandler<P2pMessage> {
}
private void sendPeers() {
Set<PeerInfo> peers = WorldManager.getInstance().getPeerDiscovery().getPeers();
if (lastPeersSent != null && peers.equals(lastPeersSent)){
logger.info("No new peers discovered don't answer for GetPeers");
return;
}
Set<Peer> peerSet = new HashSet<>();
for (PeerInfo peer : peers){
new Peer(peer.getAddress(), peer.getPort(), peer.getPeerId());
}
PeersMessage msg = new PeersMessage(peerSet);
lastPeersSent = peers;
msgQueue.sendMessage(msg);
}

View File

@ -9,8 +9,8 @@ peer.discovery.ip.list = poc-7.ethdev.com:30303,\
185.43.109.23:30303
# Peer Server Zero (poc-7.ethdev.com)
#peer.active.ip = 207.12.89.180
#peer.active.port = 30303
peer.active.ip = 23.22.211.45
peer.active.port = 60606
# ZeroGox
@ -18,8 +18,8 @@ peer.discovery.ip.list = poc-7.ethdev.com:30303,\
#peer.active.port = 30303
# Winslave
peer.active.ip = 185.43.109.23
peer.active.port = 30303
#peer.active.ip = 185.43.109.23
#peer.active.port = 30303
# Mist
#peer.active.ip = 213.46.28.223
@ -76,7 +76,7 @@ samples.dir = samples
# the existing database will be
# destroyed and all the data will be
# downloaded from peers again
database.reset = true
database.reset = false
# place to save physical storage files
database.dir = database