forked from I2P_Developers/i2p.i2p
* SessionKeyManager:
- Fix TagSet hashCode - More synchronization
This commit is contained in:
@@ -699,10 +699,8 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
|||||||
*/
|
*/
|
||||||
List<TagSet> getTagSets() {
|
List<TagSet> getTagSets() {
|
||||||
List<TagSet> rv;
|
List<TagSet> rv;
|
||||||
synchronized (_unackedTagSets) {
|
|
||||||
rv = new ArrayList(_unackedTagSets);
|
|
||||||
}
|
|
||||||
synchronized (_tagSets) {
|
synchronized (_tagSets) {
|
||||||
|
rv = new ArrayList(_unackedTagSets);
|
||||||
rv.addAll(_tagSets);
|
rv.addAll(_tagSets);
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
@@ -714,17 +712,21 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
|||||||
* because the tagset was originally placed directly on the acked list.
|
* because the tagset was originally placed directly on the acked list.
|
||||||
*/
|
*/
|
||||||
void ackTags(TagSet set) {
|
void ackTags(TagSet set) {
|
||||||
if (_unackedTagSets.remove(set)) {
|
synchronized (_tagSets) {
|
||||||
_tagSets.add(set);
|
if (_unackedTagSets.remove(set)) {
|
||||||
_acked = true;
|
_tagSets.add(set);
|
||||||
|
_acked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
set.setAcked();
|
set.setAcked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** didn't get an ack for these tags */
|
/** didn't get an ack for these tags */
|
||||||
void failTags(TagSet set) {
|
void failTags(TagSet set) {
|
||||||
_unackedTagSets.remove(set);
|
synchronized (_tagSets) {
|
||||||
_tagSets.remove(set);
|
_unackedTagSets.remove(set);
|
||||||
|
_tagSets.remove(set);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PublicKey getTarget() {
|
public PublicKey getTarget() {
|
||||||
@@ -919,6 +921,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
|||||||
/** only used in renderStatusHTML() for debugging */
|
/** only used in renderStatusHTML() for debugging */
|
||||||
public boolean getAcked() { return _acked; }
|
public boolean getAcked() { return _acked; }
|
||||||
|
|
||||||
|
/****** this will return a dup if two in the same ms, so just use java
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
long rv = 0;
|
long rv = 0;
|
||||||
@@ -936,6 +939,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
|||||||
//&& DataHelper.eq(ts.getTags(), getTags())
|
//&& DataHelper.eq(ts.getTags(), getTags())
|
||||||
&& ts.getDate() == _date;
|
&& ts.getDate() == _date;
|
||||||
}
|
}
|
||||||
|
******/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Reference in New Issue
Block a user