Commit Graph

132 Commits

Author SHA1 Message Date
Joshua Kissoon
24abfe3d2a Storage Entry Usage
- Now we manage storage entries directly from the KadNode 
- rather than creating them all over the place
2014-05-11 15:39:43 +05:30
Joshua Kissoon
7b95d03d96 Moved the HashCalculator to the utils package rather than have it in a package of it's own
Keep the StorageEntry content in the byte[] format it was originally in rather than constantly changing it to a string
2014-05-11 15:15:26 +05:30
Joshua Kissoon
428cab774b Node
- Update the node's getInetAddress method to return InetSocketAddress instead of SocketAddress since we get more methods available with this
-- Specifically we get a comparison method which is needed
2014-05-11 12:36:10 +05:30
Joshua Kissoon
06f9eeae43 Updated the operation timeout to be the same as the response timeout! 2014-05-11 10:40:46 +05:30
Joshua Kissoon
210e3842ca ContentLookupOperation
- Forgot to initialize the route length checker

DHT
- Setup the subfolder for content to be 2 digits in length instead of 10
-- With 10, we only have 1 content in a folder, 2 will be better since > 1 content will be in a folder
-- Content with similar key tend to be in the same user, so they'll be alot in the same folder
2014-05-10 23:34:17 +05:30
Joshua Kissoon
d242e0a13a Route Length Computation
- Before we were doing this by just adding incrementing a value everytime we get a set of nodes as the reply of a FIND_NODE or FIND_VALUE RPC
-- This may be wrong since nodes the same distance away may reply and we'll still be incrementing for both
- Created a route length checker class to properly check route lengths

ContentLookupOperation
- Added the route length check to the CLO operation

Didn't add it to the NodeLookupOperation since I'm not sure we're using it anywhere... Though it can be useful there
2014-05-10 21:17:44 +05:30
Joshua Kissoon
799a4887dd Node Lookup OP
- Removed the unused error boolean
2014-05-10 21:15:24 +05:30
Joshua Kissoon
4fbc29fa24 NodeLookupOperation
- Removed the unused error variable
2014-05-10 21:06:46 +05:30
Joshua Kissoon
ed0a833e1a KadBucket Bug
- We were checking if the contact stale count was ">" stale value rather than ">=" stale value
2014-05-10 20:36:39 +05:30
Joshua Kissoon
673979c29a Routing Table
- We were not resetting the stale count of a contact when we saw it again, did that now
2014-05-10 19:52:21 +05:30
Joshua Kissoon
111cdc9e05 KadBucket
- Updated toString to display stale count of a contact

DHT
- Updated toString to print a count of content.
2014-05-10 19:28:19 +05:30
Joshua Kissoon
58696d627a Made a few KadBucket methods private
Changed the comparison of KademliaId to use the hashcode
2014-05-09 16:05:14 +05:30
Joshua Kissoon
e8f0e20a8f Seems we over-synchronized the DHT
- Removed the blocking synchronizations
2014-05-09 14:11:58 +05:30
Joshua Kissoon
f5409c70e9 Removed the excess method syncs 2014-05-09 13:22:40 +05:30
Joshua Kissoon
565bf50ddb Added some synchronization to the KadBucket and DHT 2014-05-09 11:54:21 +05:30
Joshua Kissoon
3ab6b3d2ab Renamed NodeId to KademliaId Since that's basically what it is! 2014-05-09 11:03:00 +05:30
Joshua Kissoon
ac950720f3 Contact
- Added equals() and hashCode() methods

KadBucketImpl
- Used a TreeSet instead of the TreeMap
2014-05-09 10:00:56 +05:30
Joshua Kissoon
f66d5f662f Routing Table Find Closest
- Added a shorter method
- Create a treeset to sort the nodes
- Add all nodes in the routing table to the treeset
- Then select the top Q nodes required from the treeset
2014-05-09 09:27:35 +05:30
Joshua Kissoon
89d5c48d28 Bucket Refresh Operation
- Just found a major Bug!!! We were doing 160 refreshes looking for nodes with the local nodeId as the lookup ID for all 160 refreshes
- Updated to check for nodes at different distances from the local NodeId

Content Lookup Operation
- We were still using KademliaNode instead of KademliaNode.getNode to use the mini node for comparisons
2014-05-08 22:28:22 +05:30
Joshua Kissoon
98fc727cbe Stop shutting down the server when we catch an exception
Catch a content not found exception in ContentLookupReceiver
2014-05-08 18:41:07 +05:30
Joshua Kissoon
72048ad8a1 Statistician
- Return data sent in KiloBytes instead of bytes
2014-05-08 10:58:24 +05:30
Joshua Kissoon
3705107ce6 KademliaNode
- Removed the isRunning boolean since it's not used
- Made the statistician transient since we only keep stats temporary
2014-05-08 10:41:51 +05:30
Joshua Kissoon
1ff0fb8284 Statistician
- Setup the bootstrap time to be in milliseconds instead of nanoseconds
2014-05-08 00:14:57 +05:30
Joshua Kissoon
32a6d7875b Statistician
- Made it an interface
- Implemented the interface and made the changes in the code to use the interface

- We do this because we'll extend the code for SocialKad
2014-05-07 23:45:23 +05:30
Joshua Kissoon
1d5d8004df KadServer
- Introduced artificial latency when we're in testing mode

ContentLookup & NodeLookup Operations
- Reduce the wait time between data checks to 10 milliseconds
2014-05-07 23:14:49 +05:30
Joshua Kissoon
e771c8fd44 Configuration
- Added Information to specify whether we're in a testing environment or a production environment
-- we can use this information to put in network latency, etc

Statistician
- Adding counting the number of sendData and receiveData operations

KademliaNode
- Removed the counting of contentLookup if we're getting the content from local storage
2014-05-07 22:43:15 +05:30
Joshua Kissoon
70bf6044b3 Added toString to statistician 2014-05-07 21:23:04 +05:30
Joshua Kissoon
718fa78b9d Statistician
- Returns some times in milliseconds instead of microseconds

KadServer
- Made a few operations synchronized
- Handled the exception when the timer is already canceled
2014-05-07 11:22:02 +05:30
Joshua Kissoon
1bee79789d Statistician
- Formatted the double returned by averages
2014-05-07 10:07:12 +05:30
Joshua Kissoon
67f6a0fe07 Statistician
- Added a method to find average content lookup route length
2014-05-07 09:46:48 +05:30
Joshua Kissoon
b90a87b149 Statistician
- Added measuring the route Length (Hop Length) of content lookup operation
2014-05-07 09:26:29 +05:30
Joshua Kissoon
92ce527c0c Statistician
- Changed over to using nanoseconds instead of milliseconds
-- Better Accuracy
-- milliseconds is not always properly measured
2014-05-07 00:54:55 +05:30
Joshua Kissoon
095738dcbc Statistician
- Added Timing Node Bootstrap.
- Added timing content lookup operation.
2014-05-07 00:41:49 +05:30
Joshua Kissoon
baeb656050 Cleaned up the code a bit
- Removed some unnecessary exception throwing
2014-05-06 12:59:43 +05:30
Joshua Kissoon
64dfdda1c3 Added a few utility methods 2014-05-06 09:53:06 +05:30
Joshua Kissoon
2adfc9b277 Statistics
- Added aggregation of total data sent and received by Server
2014-05-06 09:27:40 +05:30
Joshua Kissoon
899390b4a3 Statistics
- Renamed the statistics class to Statistician since that's is what it is - a statistician that manages the Kad statistics
- Passed the statistician to our Server to collect data
2014-05-06 09:21:34 +05:30
Joshua Kissoon
7817100253 Statistics
- Started working on a statistics class to collect Kad statistics
2014-05-06 09:13:16 +05:30
Joshua Kissoon
8aecda34c7 Added methods to start and stop the refresh operation 2014-05-05 18:03:57 +05:30
Joshua Kissoon
8d3ceb3ae1 We need to synchronize some toString methods since they access some data structures that cannot be modified concurrently 2014-05-05 15:47:07 +05:30
Joshua Kissoon
d920f2621e Added synchronization to prevent concurrency exceptions 2014-05-05 14:54:49 +05:30
Joshua Kissoon
0c4a40d9ca Removed some unnecessary print statements 2014-05-05 14:05:00 +05:30
Joshua Kissoon
37337afc66 There was an error when we recursively called the synchronized KadBucket.insert method
- Fixed it by removing the recursion
2014-05-05 12:46:44 +05:30
Joshua Kissoon
1e2cc037de Synchronization
- We were getting some concurrency exceptions because certain data structures were being modified concurrently
- Solved the issues by synchronizing the methods modifying the data structures
2014-05-05 10:52:44 +05:30
Joshua Kissoon
cb42c507de Concurrency Modification Error Fixed
We were getting a concurrency Modification error on the treemap because multiple operations may have been accessing the RoutingTable's getAllNodes() method at once.
- Fixed it by making this method synchronized.
2014-05-01 19:22:26 +05:30
Joshua Kissoon
0ce64529c6 Saving State & Reloading
- Routing Table had a save state issue because of the KadConfiguration
-- I removed saving the configuration since this may change from boot to boot
-- Provided a way to set a new configuration to the routing table
-- Updated the serializer/deserializer
2014-05-01 16:52:31 +05:30
Joshua Kissoon
66b6a14ebc Routing Table
- Added a routing table interface to code to Interface not implementation
2014-05-01 15:03:20 +05:30
Joshua Kissoon
fa242fad6a Renamed the bucket classes and interface to clear up things 2014-05-01 14:42:21 +05:30
Joshua Kissoon
1e6b9f2e38 Replacement Cache update
- If we're trying to add a node that's already in the replacement cache, update the last seen time of this node
2014-05-01 11:44:25 +05:30
Joshua Kissoon
9c05736ef8 Updated content lookup operation and node lookup operation
- Use all nodes to these operations initially instead of the K-Closest because there may be the case that the K-Closest are offline
- The operation takes care of looking at the K-Closest.
2014-05-01 11:41:12 +05:30