From 438ea1b269121ff4968a7a21ca563550d5073e5c Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 20 May 2009 22:35:56 +0000 Subject: [PATCH] fix db writes to disk broken in last checkin --- .../i2p/router/networkdb/kademlia/PersistentDataStore.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java index df6a61237c..6f89551e2f 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java @@ -193,9 +193,11 @@ class PersistentDataStore extends TransientDataStore { while (true) { // get a new iterator every time to get a random entry without // having concurrency issues or copying to a List or Array - Iterator<Hash> iter = _keys.keySet().iterator(); + Iterator<Map.Entry<Hash, DataStructure>> iter = _keys.entrySet().iterator(); try { - key = iter.next(); + Map.Entry<Hash, DataStructure> entry = iter.next(); + key = entry.getKey(); + data = entry.getValue(); iter.remove(); count++; } catch (NoSuchElementException nsee) { @@ -207,7 +209,6 @@ class PersistentDataStore extends TransientDataStore { } if (key != null) { - data = _keys.get(key); if (data != null) { write(key, data); data = null; -- GitLab