diff --git a/src/kademlia/dht/DHT.java b/src/kademlia/dht/DHT.java index e5f194c..ae631e1 100644 --- a/src/kademlia/dht/DHT.java +++ b/src/kademlia/dht/DHT.java @@ -80,7 +80,7 @@ public class DHT * * @throws java.io.IOException */ - public boolean store(StorageEntry content) throws IOException + public synchronized boolean store(StorageEntry content) throws IOException { /* Lets check if we have this content and it's the updated version */ if (this.entriesManager.contains(content.getContentMetadata())) @@ -142,7 +142,7 @@ public class DHT } - public boolean store(KadContent content) throws IOException + public synchronized boolean store(KadContent content) throws IOException { return this.store(new StorageEntry(content)); } diff --git a/src/kademlia/dht/StoredContentManager.java b/src/kademlia/dht/StoredContentManager.java index 3d541a5..5eee9bb 100644 --- a/src/kademlia/dht/StoredContentManager.java +++ b/src/kademlia/dht/StoredContentManager.java @@ -69,7 +69,7 @@ class StoredContentManager * * @return boolean */ - public boolean contains(GetParameter param) + public synchronized boolean contains(GetParameter param) { if (this.entries.containsKey(param.getKey())) { @@ -93,7 +93,7 @@ class StoredContentManager /** * Check if a content exist in the DHT */ - public boolean contains(KadContent content) + public synchronized boolean contains(KadContent content) { return this.contains(new GetParameter(content)); } @@ -101,7 +101,7 @@ class StoredContentManager /** * Check if a StorageEntry exist on this DHT */ - public boolean contains(StorageEntryMetadata entry) + public synchronized boolean contains(StorageEntryMetadata entry) { return this.contains(new GetParameter(entry)); }