Flags fixup

This commit is contained in:
zzz
2009-05-26 14:48:58 +00:00
parent 91c389777a
commit 906482823c
4 changed files with 23 additions and 21 deletions

View File

@ -58,9 +58,10 @@ class ProfileOrganizerRenderer {
int failing = 0; int failing = 0;
StringBuffer buf = new StringBuffer(16*1024); StringBuffer buf = new StringBuffer(16*1024);
buf.append("<h2>Peer Profiles</h2>\n"); buf.append("<h2>Peer Profiles</h2>\n");
buf.append("<p>Showing ").append(order.size()).append(" recent profiles, hiding ").append(peers.size()-order.size()).append(" older profiles</p>");
buf.append("<table border=\"1\">"); buf.append("<table border=\"1\">");
buf.append("<tr>"); buf.append("<tr>");
buf.append("<td><b>Peer</b> (").append(order.size()).append(", hiding ").append(peers.size()-order.size()).append(")</td>"); buf.append("<td><b>Peer</b></td>");
buf.append("<td><b>Groups (Caps)</b></td>"); buf.append("<td><b>Groups (Caps)</b></td>");
buf.append("<td><b>Speed</b></td>"); buf.append("<td><b>Speed</b></td>");
buf.append("<td><b>Capacity</b></td>"); buf.append("<td><b>Capacity</b></td>");
@ -97,7 +98,7 @@ class ProfileOrganizerRenderer {
buf.append("<tr><td colspan=\"7\"><hr /></td></tr>\n"); buf.append("<tr><td colspan=\"7\"><hr /></td></tr>\n");
prevTier = tier; prevTier = tier;
buf.append("<tr><td>"); buf.append("<tr><td nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer)); buf.append(_context.commSystem().renderPeerHTML(peer));
buf.append("</td><td>"); buf.append("</td><td>");
@ -179,7 +180,7 @@ class ProfileOrganizerRenderer {
PeerProfile prof = (PeerProfile)iter.next(); PeerProfile prof = (PeerProfile)iter.next();
Hash peer = prof.getPeer(); Hash peer = prof.getPeer();
buf.append("<tr><td>"); buf.append("<tr><td nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer)); buf.append(_context.commSystem().renderPeerHTML(peer));
buf.append("</td>"); buf.append("</td>");
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer); RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);

View File

@ -128,6 +128,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
} }
int getTransportCount() { return _manager.getTransportCount(); } int getTransportCount() { return _manager.getTransportCount(); }
/** Send the message out */
public void processMessage(OutNetMessage msg) { public void processMessage(OutNetMessage msg) {
//GetBidsJob j = new GetBidsJob(_context, this, msg); //GetBidsJob j = new GetBidsJob(_context, this, msg);
//j.runJob(); //j.runJob();
@ -436,6 +437,16 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
public String renderPeerHTML(Hash peer) { public String renderPeerHTML(Hash peer) {
String h = peer.toBase64().substring(0, 4); String h = peer.toBase64().substring(0, 4);
StringBuffer buf = new StringBuffer(128); StringBuffer buf = new StringBuffer(128);
String c = getCountry(peer);
if (c != null) {
buf.append("<img alt=\"").append(c.toUpperCase()).append("\" title=\"");
String n = _geoIP.fullName(c);
if (n != null)
buf.append(n);
else
buf.append(c);
buf.append("\" src=\"/flags.jsp?c=").append(c).append("\"> ");
}
buf.append("<tt><font size=\"+1\">"); buf.append("<tt><font size=\"+1\">");
boolean found = _context.netDb().lookupRouterInfoLocally(peer) != null; boolean found = _context.netDb().lookupRouterInfoLocally(peer) != null;
if (found) if (found)
@ -444,16 +455,6 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
if (found) if (found)
buf.append("</a>"); buf.append("</a>");
buf.append("</font></tt>"); buf.append("</font></tt>");
String c = getCountry(peer);
if (c != null) {
buf.append(" <img alt=\"").append(c.toUpperCase()).append("\" title=\"");
String n = _geoIP.fullName(c);
if (n != null)
buf.append(n);
else
buf.append(c);
buf.append("\" src=\"/flags.jsp?c=").append(c).append("\">");
}
return buf.toString(); return buf.toString();
} }
} }

View File

@ -265,7 +265,7 @@ public class NTCPTransport extends TransportImpl {
boolean established = isEstablished(toAddress.getIdentity()); boolean established = isEstablished(toAddress.getIdentity());
if (established) { // should we check the queue size? nah, if its valid, use it if (established) { // should we check the queue size? nah, if its valid, use it
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("fast bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64() + " as its already established"); _log.debug("fast bid when trying to send to " + peer.toBase64() + " as its already established");
return _fastBid; return _fastBid;
} }
RouterAddress addr = toAddress.getTargetAddress(STYLE); RouterAddress addr = toAddress.getTargetAddress(STYLE);
@ -275,7 +275,7 @@ public class NTCPTransport extends TransportImpl {
_context.statManager().addRateData("ntcp.bidRejectedNoNTCPAddress", 1, 0); _context.statManager().addRateData("ntcp.bidRejectedNoNTCPAddress", 1, 0);
//_context.shitlist().shitlistRouter(toAddress.getIdentity().calculateHash(), "No NTCP address", STYLE); //_context.shitlist().shitlistRouter(toAddress.getIdentity().calculateHash(), "No NTCP address", STYLE);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("no bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64() + " as they don't have an ntcp address"); _log.debug("no bid when trying to send to " + peer.toBase64() + " as they don't have an ntcp address");
return null; return null;
} }
NTCPAddress naddr = new NTCPAddress(addr); NTCPAddress naddr = new NTCPAddress(addr);
@ -284,7 +284,7 @@ public class NTCPTransport extends TransportImpl {
markUnreachable(peer); markUnreachable(peer);
//_context.shitlist().shitlistRouter(toAddress.getIdentity().calculateHash(), "Invalid NTCP address", STYLE); //_context.shitlist().shitlistRouter(toAddress.getIdentity().calculateHash(), "Invalid NTCP address", STYLE);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("no bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64() + " as they don't have a valid ntcp address"); _log.debug("no bid when trying to send to " + peer.toBase64() + " as they don't have a valid ntcp address");
return null; return null;
} }
if (!naddr.isPubliclyRoutable()) { if (!naddr.isPubliclyRoutable()) {
@ -292,14 +292,14 @@ public class NTCPTransport extends TransportImpl {
_context.statManager().addRateData("ntcp.bidRejectedLocalAddress", 1, 0); _context.statManager().addRateData("ntcp.bidRejectedLocalAddress", 1, 0);
markUnreachable(peer); markUnreachable(peer);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("no bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64() + " as they have a private ntcp address"); _log.debug("no bid when trying to send to " + peer.toBase64() + " as they have a private ntcp address");
return null; return null;
} }
} }
if (!allowConnection()) { if (!allowConnection()) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("no bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64() + ", max connection limit reached"); _log.warn("no bid when trying to send to " + peer.toBase64() + ", max connection limit reached");
return _transientFail; return _transientFail;
} }
@ -307,7 +307,7 @@ public class NTCPTransport extends TransportImpl {
// return null; // dont talk to yourself // return null; // dont talk to yourself
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("slow bid when trying to send to " + toAddress.getIdentity().calculateHash().toBase64()); _log.debug("slow bid when trying to send to " + peer.toBase64());
return _slowBid; return _slowBid;
} }
@ -655,7 +655,7 @@ public class NTCPTransport extends TransportImpl {
buf.setLength(0); buf.setLength(0);
for (Iterator iter = peers.iterator(); iter.hasNext(); ) { for (Iterator iter = peers.iterator(); iter.hasNext(); ) {
NTCPConnection con = (NTCPConnection)iter.next(); NTCPConnection con = (NTCPConnection)iter.next();
buf.append("<tr><td>"); buf.append("<tr><td nowrap>");
buf.append(_context.commSystem().renderPeerHTML(con.getRemotePeer().calculateHash())); buf.append(_context.commSystem().renderPeerHTML(con.getRemotePeer().calculateHash()));
//byte[] ip = getIP(con.getRemotePeer().calculateHash()); //byte[] ip = getIP(con.getRemotePeer().calculateHash());
//if (ip != null) //if (ip != null)

View File

@ -1807,7 +1807,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append("<tr>"); buf.append("<tr>");
buf.append("<td>"); buf.append("<td nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer.getRemotePeer())); buf.append(_context.commSystem().renderPeerHTML(peer.getRemotePeer()));
//byte ip[] = peer.getRemoteIP(); //byte ip[] = peer.getRemoteIP();
//if (ip != null) //if (ip != null)