Permalink
Browse files

merge new dht code

  • Loading branch information...
1 parent 42cc4fc commit 961fd20039c15c6dcb4dbb3a9e75de0267a563fd @isdal isdal committed Mar 11, 2012
Showing with 9,868 additions and 3,452 deletions.
  1. +1 −1 .gitignore
  2. +64 −7 az_src/src/com/aelitis/azureus/core/dht/DHT.java
  3. +5 −3 az_src/src/com/aelitis/azureus/core/dht/DHTOperationAdapter.java
  4. +4 −2 az_src/src/com/aelitis/azureus/core/dht/DHTOperationListener.java
  5. +17 −2 az_src/src/com/aelitis/azureus/core/dht/DHTStorageAdapter.java
  6. +3 −0 az_src/src/com/aelitis/azureus/core/dht/DHTStorageKeyStats.java
  7. +62 −14 az_src/src/com/aelitis/azureus/core/dht/control/DHTControl.java
  8. +3 −1 az_src/src/com/aelitis/azureus/core/dht/control/DHTControlAdapter.java
  9. +3,034 −2,266 az_src/src/com/aelitis/azureus/core/dht/control/impl/DHTControlImpl.java
  10. +64 −4 az_src/src/com/aelitis/azureus/core/dht/control/impl/DHTControlStatsImpl.java
  11. +28 −3 az_src/src/com/aelitis/azureus/core/dht/db/DHTDB.java
  12. +2 −0 az_src/src/com/aelitis/azureus/core/dht/db/DHTDBFactory.java
  13. +9 −0 az_src/src/com/aelitis/azureus/core/dht/db/DHTDBStats.java
  14. +2,247 −297 az_src/src/com/aelitis/azureus/core/dht/db/impl/DHTDBImpl.java
  15. +302 −53 az_src/src/com/aelitis/azureus/core/dht/db/impl/DHTDBMapping.java
  16. +50 −7 az_src/src/com/aelitis/azureus/core/dht/db/impl/DHTDBValueImpl.java
  17. +58 −6 az_src/src/com/aelitis/azureus/core/dht/impl/DHTImpl.java
  18. +1 −1 az_src/src/com/aelitis/azureus/core/dht/impl/DHTLog.java
  19. +116 −19 az_src/src/com/aelitis/azureus/core/dht/nat/impl/DHTNATPuncherImpl.java
  20. +3 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/DHTNetworkPosition.java
  21. +34 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/DHTNetworkPositionListener.java
  22. +224 −36 az_src/src/com/aelitis/azureus/core/dht/netcoords/DHTNetworkPositionManager.java
  23. +34 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/DHTNetworkPositionProviderListener.java
  24. +3 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/vivaldi/ver1/Coordinates.java
  25. +4 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/vivaldi/ver1/impl/HeightCoordinatesImpl.java
  26. +5 −0 az_src/src/com/aelitis/azureus/core/dht/netcoords/vivaldi/ver1/impl/VivaldiPositionImpl.java
  27. +1 −1 az_src/src/com/aelitis/azureus/core/dht/netcoords/vivaldi/ver1/impl/tests/VivaldiVisualTest.java
  28. +6 −5 az_src/src/com/aelitis/azureus/core/dht/router/DHTRouter.java
  29. +6 −0 az_src/src/com/aelitis/azureus/core/dht/router/impl/DHTRouterContactImpl.java
  30. +152 −8 az_src/src/com/aelitis/azureus/core/dht/router/impl/DHTRouterImpl.java
  31. +13 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransport.java
  32. +21 −1 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportContact.java
  33. +1 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportException.java
  34. +15 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportFullStats.java
  35. +3 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportListener.java
  36. +34 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportQueryStoreReply.java
  37. +7 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportReplyHandler.java
  38. +10 −19 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportReplyHandlerAdapter.java
  39. +8 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportRequestHandler.java
  40. +15 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportStats.java
  41. +12 −0 az_src/src/com/aelitis/azureus/core/dht/transport/DHTTransportValue.java
  42. +34 −2 az_src/src/com/aelitis/azureus/core/dht/transport/loopback/DHTTransportLoopbackContactImpl.java
  43. +39 −1 az_src/src/com/aelitis/azureus/core/dht/transport/loopback/DHTTransportLoopbackImpl.java
  44. +6 −0 az_src/src/com/aelitis/azureus/core/dht/transport/loopback/DHTTransportLoopbackStatsImpl.java
  45. +34 −4 az_src/src/com/aelitis/azureus/core/dht/transport/udp/DHTTransportUDP.java
  46. +34 −4 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTTransportUDPContactImpl.java
  47. +594 −35 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTTransportUDPImpl.java
  48. +11 −2 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTTransportUDPStatsImpl.java
  49. +28 −3 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketData.java
  50. +21 −7 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketHelper.java
  51. +14 −8 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReply.java
  52. +3 −2 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyError.java
  53. +4 −2 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyFindNode.java
  54. +4 −2 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyFindValue.java
  55. +3 −1 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyKeyBlock.java
  56. +4 −2 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyPing.java
  57. +193 −0 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyQueryStorage.java
  58. +3 −1 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyStats.java
  59. +3 −1 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketReplyStore.java
  60. +8 −5 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketRequest.java
  61. +44 −1 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketRequestFindNode.java
  62. +168 −0 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketRequestQueryStorage.java
  63. +3 −3 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPPacketRequestStore.java
  64. +211 −33 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/DHTUDPUtils.java
  65. +40 −21 az_src/src/com/aelitis/azureus/core/dht/transport/udp/impl/packethandler/DHTUDPPacketHandler.java
  66. +1 −0 ...c/com/aelitis/azureus/core/dht/transport/udp/impl/packethandler/DHTUDPPacketHandlerException.java
  67. +5 −2 ...src/com/aelitis/azureus/core/dht/transport/udp/impl/packethandler/DHTUDPPacketNetworkHandler.java
  68. +15 −0 az_src/src/com/aelitis/azureus/core/dht/transport/util/DHTTransportRequestCounter.java
  69. +161 −11 az_src/src/com/aelitis/azureus/core/dht/transport/util/DHTTransportStatsImpl.java
  70. +851 −406 az_src/src/com/aelitis/azureus/plugins/dht/DHTPlugin.java
  71. +19 −0 az_src/src/com/aelitis/azureus/plugins/dht/DHTPluginContact.java
  72. +4 −0 az_src/src/com/aelitis/azureus/plugins/dht/DHTPluginOperationListener.java
  73. +3 −0 az_src/src/com/aelitis/azureus/plugins/dht/DHTPluginValue.java
  74. +58 −1 az_src/src/com/aelitis/azureus/plugins/dht/impl/DHTPluginContactImpl.java
  75. +220 −33 az_src/src/com/aelitis/azureus/plugins/dht/impl/DHTPluginImpl.java
  76. +337 −102 az_src/src/com/aelitis/azureus/plugins/dht/impl/DHTPluginStorageManager.java
  77. +7 −1 az_src/src/com/aelitis/azureus/plugins/dht/impl/DHTPluginValueImpl.java
View
@@ -25,7 +25,7 @@ error.log
.gwt/
# Run output
-plugins/
+./plugins/
speed_check.log
# Eclipse
@@ -30,6 +30,7 @@
import com.aelitis.azureus.core.dht.router.DHTRouter;
import com.aelitis.azureus.core.dht.speed.DHTSpeedTester;
import com.aelitis.azureus.core.dht.transport.DHTTransport;
+import com.aelitis.azureus.core.dht.transport.DHTTransportContact;
import com.aelitis.azureus.core.dht.transport.DHTTransportValue;
/**
@@ -51,14 +52,21 @@
public static final String PR_ORIGINAL_REPUBLISH_INTERVAL = "OriginalRepublishInterval";
public static final String PR_CACHE_REPUBLISH_INTERVAL = "CacheRepublishInterval";
- public static final byte FLAG_SINGLE_VALUE = 0x00;
- public static final byte FLAG_DOWNLOADING = 0x01;
- public static final byte FLAG_SEEDING = 0x02;
- public static final byte FLAG_MULTI_VALUE = 0x04;
- public static final byte FLAG_STATS = 0x08;
+ public static final byte FLAG_SINGLE_VALUE = 0x00;
+ public static final byte FLAG_DOWNLOADING = 0x01;
+ public static final byte FLAG_SEEDING = 0x02;
+ public static final byte FLAG_MULTI_VALUE = 0x04;
+ public static final byte FLAG_STATS = 0x08;
+ public static final byte FLAG_ANON = 0x10;
+ public static final byte FLAG_PRECIOUS = 0x20;
+ public static final byte FLAG_PUT_AND_FORGET = 0x40; // local only
+ public static final byte FLAG_OBFUSCATE_LOOKUP = (byte)0x80; // local only
- public static final int MAX_VALUE_SIZE = 256;
+ public static final int MAX_VALUE_SIZE = 512;
+ public static final byte REP_FACT_NONE = 0;
+ public static final byte REP_FACT_DEFAULT = (byte)0xff;
+
// diversification types, don't change as serialised!!!!
public static final byte DT_NONE = 1;
@@ -80,6 +88,47 @@
DHTOperationListener listener );
/**
+ * default is HIGH PRIORITY. if you change to low priority then do so consistently as
+ * operations can get out of order otherwise
+ * @param key
+ * @param description
+ * @param value
+ * @param flags
+ * @param high_priority
+ * @param listener
+ */
+
+ public void
+ put(
+ byte[] key,
+ String description,
+ byte[] value,
+ byte flags,
+ boolean high_priority,
+ DHTOperationListener listener );
+
+ public void
+ put(
+ byte[] key,
+ String description,
+ byte[] value,
+ byte flags,
+ byte life_hours,
+ boolean high_priority,
+ DHTOperationListener listener );
+
+ public void
+ put(
+ byte[] key,
+ String description,
+ byte[] value,
+ byte flags,
+ byte life_hours,
+ byte replication_control, // 4 bits 1->14 republish hours; 0=vuze default | 4 bits 0->15 maintain replicas; [ff=no replication control-use default]
+ boolean high_priority,
+ DHTOperationListener listener );
+
+ /**
* Returns value if originated from here for key
* @param key
* @return
@@ -115,6 +164,13 @@
String description,
DHTOperationListener listener );
+ public byte[]
+ remove(
+ DHTTransportContact[] contacts,
+ byte[] key,
+ String description,
+ DHTOperationListener listener );
+
public boolean
isDiversified(
byte[] key );
@@ -191,5 +247,6 @@
getLogger();
public void
- print();
+ print(
+ boolean full );
}
@@ -43,13 +43,15 @@
}
public void
- diversified()
+ diversified(
+ String desc )
{
}
-
+
public void
found(
- DHTTransportContact contact )
+ DHTTransportContact contact,
+ boolean is_closest )
{
}
@@ -40,11 +40,13 @@
int active_searches );
public void
- diversified();
+ diversified(
+ String desc );
public void
found(
- DHTTransportContact contact );
+ DHTTransportContact contact,
+ boolean is_closest );
public void
read(
@@ -38,6 +38,9 @@
public interface
DHTStorageAdapter
{
+ public int
+ getNetwork();
+
// local value operations
/**
@@ -91,15 +94,18 @@
getExistingDiversification(
byte[] key,
boolean put_operation,
- boolean exhaustive_get );
+ boolean exhaustive_get,
+ int max_depth );
public byte[][]
createNewDiversification(
+ String description,
DHTTransportContact cause,
byte[] key,
boolean put_operation,
byte diversification_type,
- boolean exhaustive_get );
+ boolean exhaustive_get,
+ int max_depth );
public int
getNextValueVersions(
@@ -130,4 +136,13 @@
public byte[]
getStorageForKey(
String key );
+
+ public int
+ getRemoteFreqDivCount();
+
+ public int
+ getRemoteSizeDivCount();
+
+ public int
+ getKeyCount();
}
@@ -36,4 +36,7 @@
public byte
getDiversification();
+
+ public String
+ getString();
}
@@ -53,12 +53,18 @@
seed(
boolean full_wait );
+ public boolean
+ isSeeded();
+
public void
put(
byte[] key,
String description,
byte[] value,
byte flags,
+ byte life_hours,
+ byte replication_control,
+ boolean high_priority,
DHTOperationListener listener );
public boolean
@@ -86,6 +92,13 @@
String description,
DHTOperationListener listener );
+ public byte[]
+ remove(
+ DHTTransportContact[] contacts,
+ byte[] key,
+ String description,
+ DHTOperationListener listener );
+
public DHTControlStats
getStats();
@@ -116,14 +129,16 @@
// support methods for DB
- public List
+ public List<DHTTransportContact>
getClosestKContactsList(
byte[] id,
boolean live_only );
- public List
- sortContactsByDistance(
- List contacts );
+ public List<DHTTransportContact>
+ getClosestContactsList(
+ byte[] id,
+ int num_to_return,
+ boolean live_only );
public void
putEncodedKey(
@@ -135,17 +150,35 @@
public void
putDirectEncodedKeys(
- byte[][] keys,
- String description,
- DHTTransportValue[][] value_sets,
- List contacts );
+ byte[][] keys,
+ String description,
+ DHTTransportValue[][] value_sets,
+ List<DHTTransportContact> contacts );
+
+ public void
+ putDirectEncodedKeys(
+ byte[][] keys,
+ String description,
+ DHTTransportValue[][] value_sets,
+ DHTTransportContact contact,
+ DHTOperationListener listener );
public int
computeAndCompareDistances(
byte[] n1,
byte[] n2,
byte[] pivot );
+ public byte[]
+ computeDistance(
+ byte[] n1,
+ byte[] n2 );
+
+ public int
+ compareDistances(
+ byte[] n1,
+ byte[] n2 );
+
public boolean
verifyContact(
DHTTransportContact c,
@@ -154,17 +187,31 @@
public boolean
lookup(
byte[] id,
+ String description,
long timeout,
DHTOperationListener listener );
- /**
- * Returns a list of DHTContact objects
- * @return
- */
+ public boolean
+ lookupEncoded(
+ byte[] id,
+ String description,
+ long timeout,
+ boolean high_priority,
+ DHTOperationListener listener );
+
+ public byte[]
+ getObfuscatedKey(
+ byte[] plain_key );
- public List
+
+ public List<DHTControlContact>
getContacts();
+ // debug method only
+
+ public void
+ pingAll();
+
public void
addListener(
DHTControlListener l );
@@ -174,5 +221,6 @@
DHTControlListener l );
public void
- print();
+ print(
+ boolean full );
}
@@ -38,12 +38,14 @@
public byte[][]
diversify(
+ String description,
DHTTransportContact cause,
boolean put_operation,
boolean existing,
byte[] key,
byte type,
- boolean exhaustive );
+ boolean exhaustive,
+ int max_depth );
public boolean
isDiversified(
Oops, something went wrong.

0 comments on commit 961fd20

Please sign in to comment.