host = splitHost[i];
if(splitPort != null && splitPort.length > i)
port = Integer.parseInt(splitPort[i]);
NetworkState networkState;
try {
networkState = new JSONRPCNetworkState(this, new URL(protocol, host, port, path), user, pass, hostChain);
} catch(MalformedURLException e) {
throw new DiabloMinerFatalException(this, "Malformed connection paramaters");
}
if(networkStateHead == null) {
networkStateHead = networkStateTail = networkState;
} else {
networkStateTail.setNetworkStateNext(networkState);
networkStateTail = networkState;
}
}
networkStateTail.setNetworkStateNext(networkStateHead);
if(line.hasOption("proxy")) {
final String[] proxySettings = line.getOptionValue("proxy").split(":");
if(proxySettings.length >= 2) {
proxy = new Proxy(Type.HTTP, new InetSocketAddress(proxySettings[0], Integer.valueOf(proxySettings[1])));
}
if(proxySettings.length >= 3) {
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(proxySettings[2], proxySettings[3].toCharArray());
}
});
}
}
if(line.hasOption("worklifetime"))
workLifetime = Integer.parseInt(line.getOptionValue("worklifetime")) * 1000;
if(line.hasOption("debug"))
debug = true;
if(line.hasOption("debugtimer"))
debugtimer = true;
if(line.hasOption("devices")) {
String devices[] = line.getOptionValue("devices").split(",");
enabledDevices = new HashSet<String>();
for(String s : devices) {
enabledDevices.add(s);
if(Integer.parseInt(s) == 0) {
error("Do not use 0 with -D, devices start at 1");
System.exit(-1);
}
}
}
if(line.hasOption("fps")) {
GPUTargetFPS = Float.parseFloat(line.getOptionValue("fps"));
if(GPUTargetFPS < 0.1) {
error("--fps argument is too low, adjusting to 0.1");
GPUTargetFPS = 0.1;
}
}
if(line.hasOption("noarray"))
GPUNoArray = true;
if(line.hasOption("worksize"))
GPUForceWorkSize = Integer.parseInt(line.getOptionValue("worksize"));
if(line.hasOption("vectors")) {
String tempVectors[] = line.getOptionValue("vectors").split(",");
GPUVectors = new Integer[tempVectors.length];
try {
for(int i = 0; i < GPUVectors.length; i++) {
GPUVectors[i] = Integer.parseInt(tempVectors[i]);
if(GPUVectors[i] > 16) {
error("DiabloMiner now uses comma-seperated vector layouts, use those instead");
System.exit(-1);
} else if(GPUVectors[i] != 1 && GPUVectors[i] != 2 && GPUVectors[i] != 3 && GPUVectors[i] != 4 && GPUVectors[i] != 8 && GPUVectors[i] != 16) {
error(GPUVectors[i] + " is not a vector length of 1, 2, 3, 4, 8, or 16");
System.exit(-1);
}
}
Arrays.sort(GPUVectors, Collections.reverseOrder());
} catch(NumberFormatException e) {
error("Cannot parse --vector argument(s)");
System.exit(-1);
}
} else {
GPUVectors = new Integer[1];
GPUVectors[0] = 1;
}
if(line.hasOption("ds"))
GPUDebugSource = true;
info("Started");
StringBuilder list = new StringBuilder(networkStateHead.getQueryUrl().toString());
NetworkState networkState = networkStateHead.getNetworkStateNext();
while(networkState != networkStateHead) {
list.append(", " + networkState.getQueryUrl());
networkState = networkState.getNetworkStateNext();
}
info("Connecting to: " + list);
long previousHashCount = 0;