2005-07-12 jrandom

* Add some data duplication to avoid a recently injected concurrency problem
      in the session tag manager (thanks redzara and romster).
This commit is contained in:
jrandom
2005-07-12 21:26:07 +00:00
committed by zzz
parent 4c230522a2
commit e9592ed400
3 changed files with 24 additions and 14 deletions

View File

@ -221,6 +221,11 @@ class TransientSessionKeyManager extends SessionKeyManager {
*
*/
public void tagsDelivered(PublicKey target, SessionKey key, Set sessionTags) {
if (_log.shouldLog(Log.DEBUG)) {
//_log.debug("Tags delivered to set " + set + " on session " + sess);
if (sessionTags.size() > 0)
_log.debug("Tags delivered: " + sessionTags.size() + " for key: " + key.toBase64() + ": " + sessionTags);
}
OutboundSession sess = getSession(target);
if (sess == null) {
createSession(target, key);
@ -229,11 +234,6 @@ class TransientSessionKeyManager extends SessionKeyManager {
sess.setCurrentKey(key);
TagSet set = new TagSet(sessionTags, key, _context.clock().now());
sess.addTags(set);
if (_log.shouldLog(Log.WARN)) {
//_log.debug("Tags delivered to set " + set + " on session " + sess);
if (sessionTags.size() > 0)
_log.warn("Tags delivered: " + sessionTags.size() + " for key: " + key.toBase64() + ": " + sessionTags);
}
}
/**
@ -696,7 +696,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
public Set dropTags() {
Set rv = null;
synchronized (TagSet.this) {
rv = _sessionTags;
rv = new HashSet(_sessionTags);
_sessionTags = Collections.EMPTY_SET;
}
return rv;
@ -707,12 +707,16 @@ class TransientSessionKeyManager extends SessionKeyManager {
}
public boolean contains(SessionTag tag) {
return _sessionTags.contains(tag);
synchronized (TagSet.this) {
return _sessionTags.contains(tag);
}
}
public void consume(SessionTag tag) {
if (contains(tag)) {
_sessionTags.remove(tag);
synchronized (TagSet.this) {
_sessionTags.remove(tag);
}
}
}
@ -721,9 +725,11 @@ class TransientSessionKeyManager extends SessionKeyManager {
return null;
}
SessionTag first = (SessionTag) _sessionTags.iterator().next();
_sessionTags.remove(first);
return first;
synchronized (TagSet.this) {
SessionTag first = (SessionTag) _sessionTags.iterator().next();
_sessionTags.remove(first);
return first;
}
}
public Exception getCreatedBy() { return _createdBy; }

View File

@ -1,4 +1,8 @@
$Id: history.txt,v 1.208 2005/07/05 17:08:56 jrandom Exp $
$Id: history.txt,v 1.209 2005/07/11 18:06:23 jrandom Exp $
2005-07-12 jrandom
* Add some data duplication to avoid a recently injected concurrency problem
in the session tag manager (thanks redzara and romster).
2005-07-11 jrandom
* Reduced the growth factor on the slow start and congestion avoidance for

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.199 $ $Date: 2005/07/05 17:08:59 $";
public final static String ID = "$Revision: 1.200 $ $Date: 2005/07/11 18:06:24 $";
public final static String VERSION = "0.5.0.7";
public final static long BUILD = 11;
public final static long BUILD = 12;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);