More properties introduced

This commit is contained in:
romanman 2014-05-22 19:49:54 +03:00
parent 9483936a2b
commit 6c5680a92d
3 changed files with 19 additions and 10 deletions

View File

@ -62,11 +62,20 @@ public class SystemProperties {
if(prop.isEmpty()) return 2;
int result =
Integer.parseInt( prop.getProperty("peer.discovery") );
Integer.parseInt( prop.getProperty("peer.discovery.workers") );
return result;
}
public int peerDiscoveryTimeout(){
if(prop.isEmpty()) return 10000;
int result =
Integer.parseInt( prop.getProperty("peer.discovery.timeout") );
return result * 1000;
}
public String toString(){

View File

@ -5,12 +5,15 @@ import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.ReadTimeoutHandler;
import org.ethereum.config.SystemProperties;
import org.ethereum.gui.PeerListener;
import org.ethereum.manager.MainData;
import org.ethereum.net.client.EthereumFrameDecoder;
import org.ethereum.net.client.PeerData;
import java.util.ArrayList;
import static org.ethereum.config.SystemProperties.config;
/**
* www.ethereumJ.com
@ -53,7 +56,7 @@ public class PeerTaster {
// Start the client.
b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000);
b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.peerDiscoveryTimeout());
ChannelFuture f = b.connect(host, port).sync(); // (5)
// Wait until the connection is closed.

View File

@ -8,13 +8,6 @@
# accept for incoming connections [true/false]
server.acceptConnections = false
# connection timeout is going to be
# used also on the try to connect
# and read new wire msg if the timeout
# fires the system will be looking for
# another peer. [seconds]
connection.timeout = 10
# specify if the mechanism
# to discover more and more
@ -29,4 +22,8 @@ peer.discovery = true
# number of workers that
# tastes the peers for being
# online [1..10]
peer.discover.workers = 5
peer.discovery.workers = 5
# connection timeout for trying to
# connect to a peer [seconds]
peer.discovery.timeout = 3