fixed parsing of peer flags

pull/1/head
Michael Peter Christen 12 years ago
parent 87e9052081
commit 5091d627bc

@ -196,10 +196,10 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
assert theHash != null; assert theHash != null;
this.hash = theHash; this.hash = theHash;
this.dna = theDna; this.dna = theDna;
final String flags = this.dna.get(Seed.FLAGS); String flags = this.dna.get(Seed.FLAGS);
if ( (flags == null) || (flags.length() != 4) ) { if (flags == null) flags = Seed.FLAGSZERO;
this.dna.put(Seed.FLAGS, Seed.FLAGSZERO); while (flags.length() < 4) flags += " ";
} this.dna.put(Seed.FLAGS, flags);
this.dna.put(Seed.NAME, checkPeerName(get(Seed.NAME, "&empty;"))); this.dna.put(Seed.NAME, checkPeerName(get(Seed.NAME, "&empty;")));
this.birthdate = -1; // this means 'not yet parsed', parse that later when it is used this.birthdate = -1; // this means 'not yet parsed', parse that later when it is used
} }
@ -1007,6 +1007,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
if ( testResult != null ) { if ( testResult != null ) {
throw new IOException("seed is not proper (" + testResult + "): " + resultSeed); throw new IOException("seed is not proper (" + testResult + "): " + resultSeed);
} }
//assert resultSeed.toString().equals(seed) : "\nresultSeed.toString() = " + resultSeed.toString() + ",\n seed = " + seed; // debug
// seed ok // seed ok
return resultSeed; return resultSeed;
@ -1092,7 +1093,8 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
final ConcurrentMap<String, String> copymap = new ConcurrentHashMap<String, String>(); final ConcurrentMap<String, String> copymap = new ConcurrentHashMap<String, String>();
copymap.putAll(this.dna); copymap.putAll(this.dna);
copymap.put(Seed.HASH, this.hash); // set hash into seed code structure copymap.put(Seed.HASH, this.hash); // set hash into seed code structure
return MapTools.map2string(copymap, ",", true); // generate string representation String s = MapTools.map2string(copymap, ",", true); // generate string representation
return s;
} }
public final String genSeedStr(final String key) { public final String genSeedStr(final String key) {

Loading…
Cancel
Save