2006-07-28 jrandom
* Actually fix the threading deadlock issue in the netDb (removing the synchronized access to individual kbuckets while validating individual entries) (thanks cervantes, postman, frosk, et al!)
This commit is contained in:
@ -1,4 +1,9 @@
|
|||||||
$Id: history.txt,v 1.499 2006-07-27 18:40:02 jrandom Exp $
|
$Id: history.txt,v 1.500 2006-07-27 22:34:59 jrandom Exp $
|
||||||
|
|
||||||
|
2006-07-28 jrandom
|
||||||
|
* Actually fix the threading deadlock issue in the netDb (removing
|
||||||
|
the synchronized access to individual kbuckets while validating
|
||||||
|
individual entries) (thanks cervantes, postman, frosk, et al!)
|
||||||
|
|
||||||
* 2006-07-27 0.6.1.23 released
|
* 2006-07-27 0.6.1.23 released
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.438 $ $Date: 2006-07-27 18:40:03 $";
|
public final static String ID = "$Revision: 1.439 $ $Date: 2006-07-27 22:35:00 $";
|
||||||
public final static String VERSION = "0.6.1.23";
|
public final static String VERSION = "0.6.1.23";
|
||||||
public final static long BUILD = 0;
|
public final static long BUILD = 1;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
@ -28,6 +28,7 @@ class KBucketSet {
|
|||||||
private I2PAppContext _context;
|
private I2PAppContext _context;
|
||||||
private Hash _us;
|
private Hash _us;
|
||||||
private KBucket _buckets[];
|
private KBucket _buckets[];
|
||||||
|
private volatile int _size;
|
||||||
|
|
||||||
public final static int BASE = 8; // must go into KEYSIZE_BITS evenly
|
public final static int BASE = 8; // must go into KEYSIZE_BITS evenly
|
||||||
public final static int KEYSIZE_BITS = Hash.HASH_LENGTH * 8;
|
public final static int KEYSIZE_BITS = Hash.HASH_LENGTH * 8;
|
||||||
@ -51,6 +52,8 @@ class KBucketSet {
|
|||||||
if (bucket >= 0) {
|
if (bucket >= 0) {
|
||||||
int oldSize = _buckets[bucket].getKeyCount();
|
int oldSize = _buckets[bucket].getKeyCount();
|
||||||
int numInBucket = _buckets[bucket].add(peer);
|
int numInBucket = _buckets[bucket].add(peer);
|
||||||
|
if (numInBucket != oldSize)
|
||||||
|
_size++;
|
||||||
if (numInBucket > BUCKET_SIZE) {
|
if (numInBucket > BUCKET_SIZE) {
|
||||||
// perhaps queue up coalesce job? naaahh.. lets let 'er grow for now
|
// perhaps queue up coalesce job? naaahh.. lets let 'er grow for now
|
||||||
}
|
}
|
||||||
@ -62,17 +65,26 @@ class KBucketSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not an exact count (due to concurrency issues) but generally correct
|
||||||
|
*
|
||||||
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
|
return _size;
|
||||||
|
/*
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (int i = 0; i < _buckets.length; i++)
|
for (int i = 0; i < _buckets.length; i++)
|
||||||
size += _buckets[i].getKeyCount();
|
size += _buckets[i].getKeyCount();
|
||||||
return size;
|
return size;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove(Hash entry) {
|
public boolean remove(Hash entry) {
|
||||||
int bucket = pickBucket(entry);
|
int bucket = pickBucket(entry);
|
||||||
KBucket kbucket = getBucket(bucket);
|
KBucket kbucket = getBucket(bucket);
|
||||||
boolean removed = kbucket.remove(entry);
|
boolean removed = kbucket.remove(entry);
|
||||||
|
if (removed)
|
||||||
|
_size--;
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user