System.out.println(seednode.getIdentityString() + " is not connected "+seednode.getHandshakeCount());
}
}
Map<FATE, Integer> totals = new EnumMap<FATE, Integer>(SeedServerTestPeerNode.FATE.class);
for(SeedServerTestPeerNode seednode : seedNodes) {
FATE fate = seednode.getFate();
Integer x = totals.get(fate);
if(x == null)
totals.put(fate, 1);
else
totals.put(fate, x+1);
System.out.println(seednode.getIdentityString() + " : "+fate+ " : "+seednode.getPeerNodeStatusString());
}
System.out.println("TOTALS:");
for (Entry<FATE, Integer> fateEntry : totals.entrySet()) {
System.out.println(fateEntry.getKey() + " : " + fateEntry.getValue());
}
System.out.println("################## ("+node.peers.countConnectedPeers()+") "+countConnectedSeednodes+'/'+node.peers.countSeednodes());
Thread.sleep(SECONDS.toMillis(5));
}
Map<FATE, Integer> totals = new EnumMap<FATE, Integer>(SeedServerTestPeerNode.FATE.class);
for(SeedServerTestPeerNode seednode : seedNodes) {
FATE fate = seednode.getFate();
Integer x = totals.get(fate);
if(x == null)
totals.put(fate, 1);
else
totals.put(fate, x+1);
System.out.println(seednode.getIdentityString() + " : "+fate+ " : "+seednode.getPeerNodeStatusString());
}
System.out.println("RESULT:TOTALS:");
for(FATE fate : totals.keySet()) {
System.out.println("RESULT:"+fate + " : "+totals.get(fate));
}
System.out.println("Completed seednodes scan.");
// Record statuses.
System.out.println("FINAL STATUS:");
long writeTime = System.currentTimeMillis();
for(SeedServerTestPeerNode peer : seedNodes) {
String status = writeTime+" : "+peer.getIdentityString()+" : "+peer.getFate();
System.out.println(status);
File logFile = new File(STATUS_DIR, peer.getIdentityString());
FileOutputStream fos = new FileOutputStream(logFile, true);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
osw.write(status+"\n");
osw.close();
FileInputStream fis = new FileInputStream(logFile);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line;
int successes = 0;
int failures = 0;
long lastSuccess = 0;
long firstSample = 0;
long countSince = writeTime - COUNT_SUCCESSES_PERIOD;
do {
line = br.readLine();
if(line == null) break;
String[] results = line.split(" : ");
if(results.length != 3) {
System.err.println("Unable to parse line in "+logFile+" : wrong number of fields : "+results.length+" : "+line);
continue;
}
long time = Long.parseLong(results[0]);
FATE fate = FATE.valueOf(results[2]);
if(firstSample == 0) firstSample = time;
if(fate == FATE.CONNECTED_SUCCESS) {
if(time >= countSince)
successes++;
lastSuccess = time;