2006-07-16 Complication

* Collect tunnel build agree/reject/expire statistics
      for each bandwidth tier of peers (and peers of unknown tiers,
      even if those shouldn't exist)
This commit is contained in:
complication
2006-07-16 17:20:46 +00:00
committed by zzz
parent f6320696dd
commit 65138357d3
5 changed files with 85 additions and 3 deletions

View File

@ -53,6 +53,9 @@ public class RouterInfo extends DataStructureImpl {
public static final String PROP_CAPABILITIES = "caps";
public static final char CAPABILITY_HIDDEN = 'H';
// Public string of chars which serve as bandwidth capacity markers
// NOTE: individual chars defined in Router.java
public static final String BW_CAPABILITY_CHARS = "KLMNO";
public RouterInfo() {
setIdentity(null);
@ -334,6 +337,24 @@ public class RouterInfo extends DataStructureImpl {
return (getCapabilities().indexOf(CAPABILITY_HIDDEN) != -1);
}
/**
* Return a string representation of this node's bandwidth tier,
* or "Unknown"
*/
public String getBandwidthTier() {
String bwTiers = BW_CAPABILITY_CHARS;
String bwTier = "Unknown";
String capabilities = getCapabilities();
// Iterate through capabilities, searching for known bandwidth tier
for (int i = 0; i < capabilities.length(); i++) {
if (bwTiers.contains(String.valueOf(capabilities.charAt(i)))) {
bwTier = String.valueOf(capabilities.charAt(i));
break;
}
}
return (bwTier);
}
public void addCapability(char cap) {
if (_options == null) _options = new OrderedProperties();
synchronized (_options) {