Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv20832/freenet/src/freenet

Modified Files:
        ConnectionHandler.java OpenConnectionManager.java Version.java 
Log Message:
Make queriesPerHour a time weighted decaying average.
Set lsHalfLifeHours=0 for previous behavior.

Print the local port number together with peer IP
in order to correlate with netstat output, both
in logs and on "Open Connections" servlet.

Version.java 
(Version) buildNumber = 6216

tcpConnection.java   Add import freenet.node.Node;
(tcpConnection.toString)
  Compare sock.getLocalPort to Node.listenport.
  Add import freenet.node.Node;
  If not equal, prepend localPort+">" to IP number of peer.
  If equal, append ">local" to IP number of peer.

Node.java Add new configuration option, lsHalfLifeHours
(Node.static) add description strings, default value 0.5
(Node) static public double lsHalfLifeHours;
(Node.init) lsHalfLifeHours = params.getDouble("lsHalfLifeHours");

Main.java
(Main.main) Pass Node.lsHalfLifeHours to new LoadStats()

LoadStats.java
(LoadStats) new field queriesPerHour
(LoadStats.LoadStats) accept lsHalfLifeHours parameter,
  queriesPerHour = new DecayingTimeWeightedAverage()
  specifying time unit of one hour and half life
  from the parameter.
(receivedQuery) move call to System.currentTimeMillis()
  out of synchronized(timesLock).  Once every times.length
  calls, call localQueryTraffic() to compute average.
(localQueryTraffic) Note current time upon entry.
  Always make an estimate, even when fewer than
  lsAcceptRatioSamples queries have been received.
  Return the decaying time weighted average of
  events per hour, instead of the instanteous value.
(DecayingTimeWeightedAverage) New private class,
  with method average(now, start, events)
  calculates average events per unit time, decaying
  with half-life specified in constructor.  
  If value was A events/hour, and subsequent
  calls submit B events/hour, after one half-life,
  the average will be (A+B)/2, and after two,
  the average will be (A+3B)/2.  Exponential decay.
  Probably should be moved into utilities...

Announcing.java  fixed typo in a comment.

OpenConnectionManager.java
  Change "Connections transferring (Receiving/Transmitting)"
  to "(Transmitting/Receiving)"
  Fix some comments.  Indentation.
  Append ch.getLocalPort() to the inbound/outbound 
  sending/receiving/both indicator.  Should add a new column.


ConnectionHandler.java
(getLocalPort) new method returns conn.getSocket().getLocalPort()
  or zero if any returned null.



Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- ConnectionHandler.java      2 Oct 2003 01:53:00 -0000       1.162
+++ ConnectionHandler.java      3 Oct 2003 08:35:19 -0000       1.163
@@ -377,6 +377,19 @@
                return c.countAsThrottled();
        }
        
+       public int getLocalPort() {
+               tcpConnection c = conn;
+               java.net.Socket sock;
+               if (c == null) return 0;
+               try {
+                       sock = conn.getSocket();
+               } catch (IOException e) { 
+                       sock = null; 
+               }
+               if(sock == null) return 0;
+               return sock.getLocalPort();
+       }
+
        String bufStatus(String name, ByteBuffer b) {
                if(b == null) return name+":(null)";
                else return name+":"+b.position()+"/"+b.limit()+

Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- OpenConnectionManager.java  28 Sep 2003 14:58:45 -0000      1.110
+++ OpenConnectionManager.java  3 Oct 2003 08:35:19 -0000       1.111
@@ -107,7 +107,7 @@
                        openConns++;
                }
         if ( maxConnections != 0 && lru.size() < maxConnections ) return;
-        /* At toad's request moving back to diong this in every thred. */
+        /* At toad's request moving back to doing this in every thred. */
 //        lru.notifyAll();
         KillSurplusConnections();
     }
@@ -616,9 +616,11 @@
        /**
      * Writes an HTML table with information about the open connections.
      [EMAIL PROTECTED]  pw                     A destination to write the HTML output 
to
-     [EMAIL PROTECTED]  iSortingMode   An optional column to sort on (0 -> natural 
LRU ordering of elements)
-     [EMAIL PROTECTED]  servletPath    A string containing the path to the servlet 
that contains this data (SCRIPT_NAME).
-     [EMAIL PROTECTED]  setMode                "new"|"old" Switches this OCM:s web 
interface between text only mode and graphical mode
+        [EMAIL PROTECTED]  req           The http request, optionally including the 
following options:
+     [EMAIL PROTECTED]  ?setSorting=   An optional column to sort on (0 -> natural 
LRU ordering of elements)
+     [EMAIL PROTECTED]  &setMode=              "new"|"old" Switches this OCM's web 
interface between 
+        *                      text only mode and graphical mode
+        [EMAIL PROTECTED]  &setLevel=    In "new" mode, choose one of three detail 
levels.
      */
        public void writeHtmlContents(PrintWriter pw,HttpServletRequest req) {
                //int iSetSorting = 0;
@@ -635,8 +637,12 @@
 
                if(req.getParameter("setSorting")!= null){
                        try{
-                               iSortingMode = 
Integer.parseInt(req.getParameter("setSorting"));//(req.getSession().getAttribute("OCMSortingMode")==null)?0:((Integer)req.getSession().getAttribute("OCMSortingMode")).intValue();
 //TODO: catch casting errors
-                       }catch(NumberFormatException e){/*iSorting=0;*/}
+                               iSortingMode = 
Integer.parseInt(req.getParameter("setSorting"));
+                               //(req.getSession().getAttribute("OCMSortingMode") == 
null) 
+                               //  ? 0 
+                               //  : 
((Integer)req.getSession().getAttribute("OCMSortingMode")).intValue(); 
+                               //TODO: catch casting errors
+                       } catch (NumberFormatException e){/*iSorting=0;*/}
                }
                if(req.getParameter("setLevel")!= null)
                        try{
@@ -660,25 +666,45 @@
                int receiving = 0;
                HashSet uniquePeers = new HashSet();
                List lConnections = new LinkedList();
-               synchronized(lru) { //DO NOT synchronize all of this method, only 
synchronize what is necessary. Any pw.print calls might deadlock since the NIOOS:s 
might call this.remove()
-                       for (Enumeration e = lru.elements() ; e.hasMoreElements() ;)
-                               lConnections.add(e.nextElement()); //Extract the 
ConnectionHandlers so that we can sort them if we want to
+               synchronized(lru) { 
+                       //DO NOT synchronize all of this method, only synchronize
+                       //what is necessary. Any pw.print calls might deadlock
+                       //since the NIOOS's might call this.remove()
+                       for (Enumeration e = lru.elements(); e.hasMoreElements(); ) {
+                               lConnections.add(e.nextElement()); 
+                               // Extract the ConnectionHandlers so that we can sort
+                               // them if we want to
+                       }
                }
                
                //Build a sorter and sort
                ConnectionHandlerComparator sorter = null;
-               if(!useOldStyle){ //Magically mutate the requested sorting in certain 
circumstances. Would be better if the iSortingMode parameter could be an vector of 
intergers specifying the full sorting strategy 
-                       if(Math.abs(iSortingMode) == 
ConnectionHandlerComparator.OUTBOUND) //Special case if we are sorting on the 
link-icon. Sort first by in/out and then by sending and then bu receiving
-                               sorter = new 
ConnectionHandlerComparator(iSortingMode,new 
ConnectionHandlerComparator(-ConnectionHandlerComparator.SENDING,new 
ConnectionHandlerComparator(-ConnectionHandlerComparator.RECEIVING)));
+               if(!useOldStyle){ 
+                       // Magically mutate the requested sorting in certain
+                       // circumstances. Would be better if the iSortingMode
+                       // parameter could be an vector of integers specifying
+                       // the full sorting strategy
+                       if(Math.abs(iSortingMode) == 
ConnectionHandlerComparator.OUTBOUND) 
+                               // Special case if we are sorting on the link-icon. 
Sort first by in/out 
+                               // and then by sending and then by receiving
+                               sorter = new ConnectionHandlerComparator
+                                       (iSortingMode, new ConnectionHandlerComparator
+                                        (-ConnectionHandlerComparator.SENDING, new 
ConnectionHandlerComparator
+                                         (-ConnectionHandlerComparator.RECEIVING
+                                          )
+                                         )
+                                        );
                        if(Math.abs(iSortingMode) == 
ConnectionHandlerComparator.ROUTING_ADDRESS&& viewLevel ==0)
-                               sorter = new 
ConnectionHandlerComparator(iSortingMode,new 
ConnectionHandlerComparator(ConnectionHandlerComparator.PEER_IDENTITY));
+                               sorter = new ConnectionHandlerComparator
+                                       (iSortingMode,new ConnectionHandlerComparator
+                                        (ConnectionHandlerComparator.PEER_IDENTITY));
                }
                if(sorter == null)
                        sorter = new ConnectionHandlerComparator(iSortingMode);
                Collections.sort(lConnections,sorter);
        
-               Iterator it=lConnections.iterator();
-               ConnectionHandler chPrev = null; //To be able to indicate repetitions
+               Iterator it = lConnections.iterator();
+               ConnectionHandler chPrev = null; // To be able to indicate repetitions
                while(it.hasNext()) {
                        ConnectionHandler ch = (ConnectionHandler) it.next();
                        buffer.append("\n<tr>");
@@ -688,38 +714,65 @@
                                String imageURL = "/servlet/images/aqua/arrow";
                                if(ch.outbound) imageURL += "_outbound";
                                else imageURL += "_inbound";
-                               if(ch.receiving() && ch.reallySending()) //Can this 
happen yet?
+                               if(ch.receiving() && ch.reallySending())
                                        imageURL += "_both";
                                else
                                        if(ch.receiving()) imageURL += "_receiving";
                                        else if(ch.reallySending()) imageURL += 
"_transmitting";
                                        else imageURL += "_sleeping";
                                imageURL += ".png";
-                               buffer.append("<center><img src='"+imageURL+"' height 
= '15' width = '24'></center></td>");
+                               buffer.append("<center><img src='" + imageURL + "' 
height = '15' width = '24'>" + 
+                                                         ch.getLocalPort() + //FIXME 
put this into its own column.
+                                                         "</center></td>");
                        }
                        NodeReference n = 
Main.node.rt.getNodeReference(ch.peerIdentity());
-                       NodeReference nPrev = 
(chPrev==null)?null:Main.node.rt.getNodeReference(chPrev.peerIdentity());
+                       NodeReference nPrev = (chPrev == null)
+                               ? null
+                               : Main.node.rt.getNodeReference(chPrev.peerIdentity());
                        String s;
                        
-                       if(n == null){
+                       if (n == null) {
                                s = "not in RT";
                                if(ch.outbound) outboundNotInRoutingtable++;
-                       }else if(n.physical.length == 0)
+                       } else if(n.physical.length == 0) {
                                s = "no addresses";
-                       else
-                               s = n.physical[1]; //physical[even] contains something 
like 'tcp', physical[odd] contains the associated address
-                       
-                       if(useOldStyle || viewLevel >1){
-                               buffer.append("<td>"+((chPrev != null && 
(chPrev.peerAddress().toString().compareTo(ch.peerAddress().toString())==0))?repetition:ch.peerAddress().toString()));
-                               buffer.append(sep+((nPrev != null && n != null && 
nPrev.equals(n))?repetition:s));
-                       }else
-                               buffer.append("<td align = 'right'>"+(n==null?"<font 
color = #555555>"+ch.peerAddress().toString()+"</font>":s));
+                       } else {
+                               s = n.physical[1]; 
+                               // physical[even] contains something like 'tcp', 
+                               // physical[odd] contains the associated address
+                       }
+                       if (useOldStyle || viewLevel > 1) {
+                               buffer.append
+                                       ("<td>" +
+                                        (
+                                         (chPrev != null && 
+                                          
(chPrev.peerAddress().toString().compareTo(ch.peerAddress().toString()) == 0)
+                                          ) 
+                                         ? repetition 
+                                         : ch.peerAddress().toString()
+                                         )
+                                        );
+                               buffer.append(sep + ((nPrev != null && n != null && 
nPrev.equals(n)) ? repetition : s));
+                       } else
+                               buffer.append
+                                       ("<td align = 'right'>" +
+                                        (n == null 
+                                         ? "<font color = 
#555555>"+ch.peerAddress().toString()+"</font>"
+                                         : s)
+                                        );
                        
                        if(!uniquePeers.contains(ch.peerIdentity().toString()))
                                uniquePeers.add(ch.peerIdentity().toString());
                        
-                       if(useOldStyle || viewLevel >1)
-                               buffer.append(sep+((chPrev != null && 
chPrev.peerIdentity()==ch.peerIdentity())?repetition:ch.peerIdentity().toString().replaceAll("
 ","&nbsp;")));
+                       if(useOldStyle || viewLevel > 1)
+                               buffer.append
+                                       (sep + 
+                                        (
+                                         (chPrev != null && chPrev.peerIdentity() == 
ch.peerIdentity())
+                                         ? repetition
+                                         : ch.peerIdentity().toString().replaceAll(" 
","&nbsp;")
+                                         )
+                                        );
                        
                        //int x = ch.sendingCount();
                        //if(x > 0) sending++;;
@@ -737,23 +790,51 @@
                                        buffer.append(sepAlignRight+"no");
                        
                        buffer.append(sepAlignRight+ch.messages());
-                       if(useOldStyle || viewLevel >0){
+                       if(useOldStyle || viewLevel > 0){
                                if(ch.reallySending())
-                                       
buffer.append(sepAlignRight+(viewLevel>1?String.valueOf(ch.sendQueueSize()):format(ch.sendQueueSize())));
+                                       buffer.append
+                                               (sepAlignRight + 
+                                                (viewLevel > 1
+                                                 ? String.valueOf(ch.sendQueueSize())
+                                                 : format(ch.sendQueueSize())
+                                                 )
+                                                );
                                else
                                        buffer.append(sepAlignRight+"-");
-                               
buffer.append(sepAlignRight+(viewLevel>1?String.valueOf(ch.totalDataSent()):format(ch.totalDataSent())).replaceAll("
 ","&nbsp;"));
+                               buffer.append
+                                       (sepAlignRight + 
+                                        (viewLevel > 1
+                                         ? String.valueOf(ch.totalDataSent())
+                                         : format(ch.totalDataSent())
+                                         ).replaceAll(" ","&nbsp;")
+                                        );
                                if(ch.receiving())
-                                       
buffer.append(sepAlignRight+(viewLevel>1?String.valueOf(ch.receiveQueueSize()):format(ch.receiveQueueSize())).replaceAll("
 ","&nbsp;"));
+                                       buffer.append
+                                               (sepAlignRight + 
+                                                (viewLevel > 1 
+                                                 ? 
String.valueOf(ch.receiveQueueSize())
+                                                 : format(ch.receiveQueueSize())
+                                                 ).replaceAll(" ","&nbsp;")
+                                                );
                                else
                                        buffer.append(sepAlignRight+"-");
-                               
buffer.append(sepAlignRight+(viewLevel>1?String.valueOf(ch.totalDataReceived()):format(ch.totalDataReceived())).replaceAll("
 ","&nbsp;"));
+                               buffer.append
+                                       (sepAlignRight + 
+                                        (viewLevel > 1
+                                         ? String.valueOf(ch.totalDataReceived())
+                                         : format(ch.totalDataReceived())
+                                         ).replaceAll(" ","&nbsp;")
+                                        );
                        }else{
                                if(ch.reallySending()||ch.receiving())
                                        
buffer.append(sepAlignRight+format(ch.sendQueueSize()));
                                else
                                        buffer.append(sepAlignRight+"-");
-                               
buffer.append(sepAlignRight+format(ch.totalDataSent()+ch.totalDataReceived()).replaceAll("
 ","&nbsp;"));
+                               buffer.append
+                                       (sepAlignRight + 
+                                        format(ch.totalDataSent() + 
ch.totalDataReceived()
+                                                       ).replaceAll(" ","&nbsp;")
+                                        );
                        }
                        sendQueueSize += ch.sendQueueSize();
                        receiveQueueSize += ch.receiveQueueSize();
@@ -784,7 +865,9 @@
         
                
                if(useOldStyle) {
-                       pw.println("<h2>Fred OpenConnectionManager Contents <font size 
= 1><A HREF = '"+req.getRequestURI()+"?setMode=new'>[Switch to graphical 
mode]</A></font></h2>");
+                       pw.println("<h2>Fred OpenConnectionManager Contents <font size 
= 1><A HREF = '" + 
+                                          req.getRequestURI() + 
+                                          "?setMode=new'>[Switch to graphical 
mode]</A></font></h2>");
                        pw.println("<b>At date: " + new Date()+"</b><br>");
                        pw.println("<br>Number of open connections: " + lru.size());
                        pw.println("<br>Number of outbound connections: " + outbound);
@@ -792,25 +875,52 @@
                        pw.println("<br>Number of connections sending messages: 
"+sending);
                        pw.println("<br>Number of connections receiving messages: 
"+receiving);
                        pw.println("<br>Bytes waiting to be sent: " + sendQueueSize);
-                       pw.println("<br>Outbound connections that are to peers not in 
the routingtable: "+100*(new Float(outboundNotInRoutingtable).floatValue()/new 
Float(outbound).floatValue())+"%");
-               }else{
-                       pw.println("<h2>Open connections <font size = 1><A HREF = 
'"+req.getRequestURI()+"?setMode=old'>[Switch to text only mode]</A></font></h2>");
+                       pw.println("<br>Outbound connections that are to peers not in 
the routingtable: " + 
+                                          100*(new 
Float(outboundNotInRoutingtable).floatValue() /
+                                                       new 
Float(outbound).floatValue()) +
+                                          "%");
+               } else {
+                       pw.println("<h2>Open connections <font size = 1><A HREF = '" + 
+                                          req.getRequestURI() + 
+                                          "?setMode=old'>[Switch to text only 
mode]</A></font></h2>");
                        pw.println("<b>"+new Date()+"</b><br>");
                        pw.println("<table><tr><td>");
                        //pw.println("<b>Connection status</b>");
                        pw.println("<table border=0 cellspacing = 1>\n");
-                       
pw.println("<tr><td>Connections&nbsp;open&nbsp;(Inbound/Outbound/Limit)</td><td width 
=10></td><td>" + 
(inbound+outbound)+"&nbsp;("+inbound+"/"+outbound+"/"+maxConnections+")</td></tr>");
+                       
pw.println("<tr><td>Connections&nbsp;open&nbsp;(Inbound/Outbound/Limit)</td><td width 
=10></td><td>" + 
+                                          (inbound+outbound) + 
+                                          "&nbsp;(" + inbound + "/" + outbound + "/" 
+ maxConnections+")</td></tr>");
 
-                       
pw.println("<tr><td>Connections&nbsp;transferring&nbsp;(Receiving/Transmitting)</td><td
 width =10></td><td>" 
+(receiving+sending)+"&nbsp;("+receiving+"/"+sending+")</td></tr>");
+                       pw.println
+                               
("<tr><td>Connections&nbsp;transferring&nbsp;(Transmitting/Receiving)</td><td 
width=10></td><td>" +
+                                (sending + receiving) + 
+                                "&nbsp;("+sending+"/"+receiving+")</td></tr>");
                        if(viewLevel>0) {
-                               pw.println("<tr><td>Data waiting to be 
transmitted/received</td><td width =10></td><td>" + format(sendQueueSize).replaceAll(" 
","&nbsp;")+"/"+format(receiveQueueSize).replaceAll(" ","&nbsp;")+"</td></tr>");
-                               pw.println("<tr><td>Amount of data 
transmitted/received over currently open connections</td><td width =10></td><td>" + 
format(totalDataSent).replaceAll(" 
","&nbsp;")+"/"+format(totalDataReceived).replaceAll(" ","&nbsp;")+"</td></tr>");
-                               pw.println("<tr><td>Outbound connections that are to 
peers not in the routingtable</td><td width =10></td><td>"+100*(new 
Float(outboundNotInRoutingtable).floatValue()/new 
Float(outbound).floatValue())+"%</td></tr>");
-                               pw.println("<tr><td>Number of distinct nodes 
connected</td><td width =10></td><td>"+uniquePeers.size()+"</td></tr>");
+                               pw.println("<tr><td>Data waiting to be 
transmitted/received</td><td width =10></td><td>" + 
+                                                  format(sendQueueSize).replaceAll(" 
","&nbsp;") + 
+                                                  "/" + 
+                                                  
format(receiveQueueSize).replaceAll(" ","&nbsp;") + 
+                                                  "</td></tr>");
+                               pw.println("<tr><td>Amount of data 
transmitted/received over currently open connections</td>" + 
+                                                  "<td width =10></td><td>" + 
+                                                  format(totalDataSent).replaceAll(" 
","&nbsp;") + 
+                                                  "/" + 
+                                                  
format(totalDataReceived).replaceAll(" ","&nbsp;") + 
+                                                  "</td></tr>");
+                               pw.println("<tr><td>Outbound connections that are to 
peers not in the routingtable</td>" + 
+                                                  "<td width =10></td><td>" + 
+                                                  100*(new 
Float(outboundNotInRoutingtable).floatValue() / 
+                                                               new 
Float(outbound).floatValue()) + 
+                                                  "%</td></tr>");
+                               pw.println("<tr><td>Number of distinct nodes 
connected</td><td width =10></td><td>" + 
+                                                  uniquePeers.size() + 
+                                                  "</td></tr>");
                                
                                //pw.println("<tr><td>&nbsp;</td></tr>");
-                       }else {
-                               pw.println("<tr><td>Data waiting to be 
transferred</td><td width =10></td><td>" + 
format(sendQueueSize+receiveQueueSize)+"</td></tr>");
+                       } else {
+                               pw.println("<tr><td>Data waiting to be 
transferred</td><td width =10></td><td>" + 
+                                                  
format(sendQueueSize+receiveQueueSize) + 
+                                                  "</td></tr>");
                                
pw.println("<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>");
                        }
                                
@@ -819,15 +929,22 @@
                        pw.println("</td><td width = 100>&nbsp;</td><td>");
                        pw.println("<table>");
                        //pw.println("<tr><td colspan = 4 align = 'center'><b>Icon 
legend</b></td></tr>");
-                       pw.println("<tr><td colspan = 
2><b>Outbound&nbsp;connections&nbsp;legend</b></td><td colspan = 
2><b>Inbound&nbsp;connections&nbsp;legend</b></td></tr>");
+                       pw.println("<tr><td colspan = 
2><b>Outbound&nbsp;connections&nbsp;legend</b></td>" + 
+                                          "<td colspan = 
2><b>Inbound&nbsp;connections&nbsp;legend</b></td></tr>");
                        pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_sleeping.png'></td><td>Idle</td>");
                        pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_sleeping.png'></td><td>Idle</td></tr>");
-                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_transmitting.png'></td><td>Transmitting 
data</td>");
-                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_transmitting.png'></td><td>Transmitting 
data</td></tr>");
-                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_receiving.png'></td><td>Receiving data</td>");
-                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_receiving.png'></td><td>Receiving 
data</td></tr>");
-                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_both.png'></td><td>Receiving&nbsp;and&nbsp;transmitting&nbsp;data</td>");
-                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_both.png'></td><td>Receiving&nbsp;and&nbsp;transmitting&nbsp;data</td></tr>");
+                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_transmitting.png'></td>" + 
+                                          "<td>Transmitting data</td>");
+                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_transmitting.png'></td>" + 
+                                          "<td>Transmitting data</td></tr>");
+                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_receiving.png'></td>" + 
+                                          "<td>Receiving data</td>");
+                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_receiving.png'></td>" + 
+                                          "<td>Receiving data</td></tr>");
+                       pw.println("<tr><td><img 
SRC='/servlet/images/aqua/arrow_outbound_both.png'></td>" + 
+                                          
"<td>Receiving&nbsp;and&nbsp;transmitting&nbsp;data</td>");
+                       pw.println("<td><img 
SRC='/servlet/images/aqua/arrow_inbound_both.png'></td>" + 
+                                          
"<td>Receiving&nbsp;and&nbsp;transmitting&nbsp;data</td></tr>");
                        pw.println("</table></td></tr></table>");
                }
                if(!useOldStyle)
@@ -845,37 +962,99 @@
                
                pw.println("<table border=1 cellspacing = 0>\n");
                
-               String sImgClause = "<img 
src='/servlet/images/aqua/s_ar_"+(iSortingMode<0?"up":"down")+"_olive.gif' height = 
'9' width = '10'>";
+               String sImgClause = "<img src='/servlet/images/aqua/s_ar_" + 
+                       (iSortingMode < 0 ? "up" : "down") + 
+                       "_olive.gif' height = '9' width = '10'>";
                
                pw.print("<tr>");
                if(!useOldStyle)
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==9?"-9":"9")+"'>"+(Math.abs(iSortingMode)==9?sImgClause:"")+"
 Type</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() + 
+                                        "?setSorting=" + (iSortingMode==9?"-9":"9") + 
"'>" + 
+                                        (Math.abs(iSortingMode) == 9 
+                                         ? sImgClause
+                                         : "" ) +
+                                        " Type</A></th>");
                if(useOldStyle || viewLevel>1) {
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==1?"-1":"1")+"'>"+(Math.abs(iSortingMode)==1?sImgClause:"")+"
 Peer address</A></th>");
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==11?"-11":"11")+"'>"+(Math.abs(iSortingMode)==11?sImgClause:"")+"
 Routing address</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==1?"-1":"1") + "'>" + 
+                                        (Math.abs(iSortingMode)==1?sImgClause:"") + " 
Peer address</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==11?"-11":"11") + "'>" + 
+                                        (Math.abs(iSortingMode)==11?sImgClause:"") + 
" Routing address</A></th>");
                }else
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==11?"-11":"11")+"'>"+(Math.abs(iSortingMode)==11?sImgClause:"")+"
 Peer</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==11?"-11":"11") + "'>" + 
+                                        (Math.abs(iSortingMode)==11?sImgClause:"") + 
" Peer</A></th>");
                if(useOldStyle || viewLevel>1)
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==2?"-2":"2")+"'>"+(Math.abs(iSortingMode)==2?sImgClause:"")+"
 Peer identity</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==2?"-2":"2") + "'>" + 
+                                        (Math.abs(iSortingMode)==2?sImgClause:"") + " 
Peer identity</A></th>");
                
                if(useOldStyle)
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==5?"-5":"5")+"'>"+(Math.abs(iSortingMode)==5?sImgClause:"")+"
 Receiving</A></th>");
-               pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==6?"-6":"6")+"'>"+(Math.abs(iSortingMode)==6?sImgClause:"")+"
 Messages</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==5?"-5":"5") + "'>" + 
+                                        (Math.abs(iSortingMode)==5?sImgClause:"") + " 
Receiving</A></th>");
+               pw.print("<th><A HREF='" + req.getRequestURI() +
+                                "?setSorting=" + 
+                                (iSortingMode==6?"-6":"6") + "'>" + 
+                                (Math.abs(iSortingMode)==6?sImgClause:"") + " 
Messages</A></th>");
                if(useOldStyle || viewLevel>0) {
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==4?"-4":"4")+"'>"+(Math.abs(iSortingMode)==4?sImgClause:"")+"
 Send&nbsp;queue</A></th>");
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==ConnectionHandlerComparator.DATASENT?"-":"")+ConnectionHandlerComparator.DATASENT+"'>"+(Math.abs(iSortingMode)==ConnectionHandlerComparator.DATASENT?sImgClause:"")+"
 Data&nbsp;sent</A></th>");
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==ConnectionHandlerComparator.RECEIVEQUEUE?"-":"")+ConnectionHandlerComparator.RECEIVEQUEUE+"'>"+(Math.abs(iSortingMode)==ConnectionHandlerComparator.RECEIVEQUEUE?sImgClause:"")+"
 Receive&nbsp;queue</A></th>");
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==ConnectionHandlerComparator.DATARECEIVED?"-":"")+ConnectionHandlerComparator.DATARECEIVED+"'>"+(Math.abs(iSortingMode)==ConnectionHandlerComparator.DATARECEIVED?sImgClause:"")+"
 Data&nbsp;received</A></th>");
-               }else{
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==ConnectionHandlerComparator.COMBINEDQUEUE?"-":"")+ConnectionHandlerComparator.COMBINEDQUEUE+"'>"+(Math.abs(iSortingMode)==ConnectionHandlerComparator.COMBINEDQUEUE?sImgClause:"")+"
 Queue</A></th>");
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED?"-":"")+ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED+"'>"+(Math.abs(iSortingMode)==ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED?sImgClause:"")+"
 Data&nbsp;transfered</A></th>");
-               }
-               
-               pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==7?"-7":"7")+"'>"+(Math.abs(iSortingMode)==7?sImgClause:"")+"
 Idletime</A></th>");
-               pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==8?"-8":"8")+"'>"+(Math.abs(iSortingMode)==8?sImgClause:"")+"
 Lifetime</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode==4?"-4":"4") + "'>" + 
+                                        (Math.abs(iSortingMode)==4?sImgClause:"") + " 
Send&nbsp;queue</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        
(iSortingMode==ConnectionHandlerComparator.DATASENT?"-":"") + 
+                                        ConnectionHandlerComparator.DATASENT + "'>" + 
+                                        
(Math.abs(iSortingMode)==ConnectionHandlerComparator.DATASENT?sImgClause:"") + 
+                                        " Data&nbsp;sent</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        
(iSortingMode==ConnectionHandlerComparator.RECEIVEQUEUE?"-":"") + 
+                                        ConnectionHandlerComparator.RECEIVEQUEUE + 
"'>" + 
+                                        
(Math.abs(iSortingMode)==ConnectionHandlerComparator.RECEIVEQUEUE?sImgClause:"") + 
+                                        " Receive&nbsp;queue</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        
(iSortingMode==ConnectionHandlerComparator.DATARECEIVED?"-":"") + 
+                                        ConnectionHandlerComparator.DATARECEIVED + 
"'>" + 
+                                        
(Math.abs(iSortingMode)==ConnectionHandlerComparator.DATARECEIVED?sImgClause:"") + 
+                                        " Data&nbsp;received</A></th>");
+               } else {
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        
(iSortingMode==ConnectionHandlerComparator.COMBINEDQUEUE?"-":"") + 
+                                        ConnectionHandlerComparator.COMBINEDQUEUE + 
"'>" + 
+                                        
(Math.abs(iSortingMode)==ConnectionHandlerComparator.COMBINEDQUEUE?sImgClause:"") + 
+                                        " Queue</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        
(iSortingMode==ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED?"-":"") + 
+                                        
ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED + "'>" + 
+                                        
(Math.abs(iSortingMode)==ConnectionHandlerComparator.COMBINED_DATA_TRANSFERED?sImgClause:"")
 + 
+                                        " Data&nbsp;transfered</A></th>");
+               }
+               
+               pw.print("<th><A HREF='" + req.getRequestURI() +
+                                "?setSorting=" + 
+                                (iSortingMode == 7 ? "-7" : "7") + "'>" + 
+                                (Math.abs(iSortingMode) == 7 ? sImgClause : "") + " 
Idletime</A></th>");
+               pw.print("<th><A HREF='" + req.getRequestURI() +
+                                "?setSorting=" + 
+                                (iSortingMode == 8 ? "-8" : "8") + "'>" + 
+                                (Math.abs(iSortingMode) == 8 ? sImgClause : "") + " 
Lifetime</A></th>");
                                
                if(useOldStyle)
-                       pw.print("<th><A 
HREF='"+req.getRequestURI()+"?setSorting="+(iSortingMode==9?"-9":"9")+"'>"+(Math.abs(iSortingMode)==9?sImgClause:"")+"
 Type</A></th>");
+                       pw.print("<th><A HREF='" + req.getRequestURI() +
+                                        "?setSorting=" + 
+                                        (iSortingMode == 9 ? "-9" : "9") + "'>" + 
+                                        (Math.abs(iSortingMode) == 9 ? sImgClause : 
"") + " Type</A></th>");
                pw.println(buffer.toString());
                pw.println("</table>");
        }
@@ -896,7 +1075,7 @@
         int val = 0;
                logDEBUG = Core.logger.shouldLog(Logger.DEBUG,this);
                if(logDEBUG)
-                       Core.logger.log(this, "Increasing blocked connection count for 
"+addr.toString(),
+                       Core.logger.log(this, "Increasing blocked connection count for 
" + addr.toString(),
                                                        Logger.DEBUG);
         synchronized(blockedConnections) {
             blockedConnectionCount++;

Index: Version.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Version.java,v
retrieving revision 1.408
retrieving revision 1.409
diff -u -r1.408 -r1.409
--- Version.java        3 Oct 2003 02:44:46 -0000       1.408
+++ Version.java        3 Oct 2003 08:35:19 -0000       1.409
@@ -18,7 +18,7 @@
     public static String protocolVersion = "1.46";
     
     /** The build number of the current revision */
-    public static final int buildNumber = 6215;
+    public static final int buildNumber = 6216;
     // 6028: may 3; ARK retrieval fix
 
     public static final int ignoreBuildsAfter = 6500;

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to