* SSUDemo: Adapt for NTCP testing too

* RouterAddress and RouterInfo toString() cleanups; don't cache RI in _stringified
* NTCP: Fix publishing address when host specified but interface is not
* log tweaks
This commit is contained in:
zzz
2013-05-19 15:18:45 +00:00
parent 729282c0c4
commit 55880844a5
5 changed files with 46 additions and 27 deletions

View File

@@ -309,10 +309,10 @@ public class RouterAddress extends DataStructureImpl {
public String toString() {
StringBuilder buf = new StringBuilder(128);
buf.append("[RouterAddress: ");
buf.append("\n\tTransportStyle: ").append(_transportStyle);
buf.append("\n\tType: ").append(_transportStyle);
buf.append("\n\tCost: ").append(_cost);
//buf.append("\n\tExpiration: ").append(_expiration);
buf.append("\n\tOptions: #: ").append(_options.size());
buf.append("\n\tOptions (").append(_options.size()).append("):");
for (Map.Entry e : _options.entrySet()) {
String key = (String) e.getKey();
String val = (String) e.getValue();

View File

@@ -61,7 +61,7 @@ public class RouterInfo extends DatabaseEntry {
private final Properties _options;
private volatile boolean _validated;
private volatile boolean _isValid;
private volatile String _stringified;
//private volatile String _stringified;
private volatile byte _byteified[];
private volatile int _hashCode;
private volatile boolean _hashCodeInitialized;
@@ -612,30 +612,34 @@ public class RouterInfo extends DatabaseEntry {
@Override
public String toString() {
if (_stringified != null) return _stringified;
StringBuilder buf = new StringBuilder(5*1024);
//if (_stringified != null) return _stringified;
StringBuilder buf = new StringBuilder(1024);
buf.append("[RouterInfo: ");
buf.append("\n\tIdentity: ").append(_identity);
buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tPublished on: ").append(new Date(_published));
buf.append("\n\tAddresses: #: ").append(_addresses.size());
for (RouterAddress addr : _addresses) {
buf.append("\n\t\tAddress: ").append(addr);
buf.append("\n\tPublished: ").append(new Date(_published));
if (_peers != null) {
buf.append("\n\tPeers (").append(_peers.size()).append("):");
for (Hash hash : _peers) {
buf.append("\n\t\tPeer hash: ").append(hash);
}
}
Set<Hash> peers = getPeers();
buf.append("\n\tPeers: #: ").append(peers.size());
for (Hash hash : peers) {
buf.append("\n\t\tPeer hash: ").append(hash);
}
buf.append("\n\tOptions: #: ").append(_options.size());
buf.append("\n\tOptions (").append(_options.size()).append("):");
for (Map.Entry e : _options.entrySet()) {
String key = (String) e.getKey();
String val = (String) e.getValue();
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
}
if (!_addresses.isEmpty()) {
buf.append("\n\tAddresses (").append(_addresses.size()).append("):");
for (RouterAddress addr : _addresses) {
buf.append("\n\t").append(addr);
}
}
buf.append("]");
_stringified = buf.toString();
return _stringified;
String rv = buf.toString();
//_stringified = rv;
return rv;
}
/**