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

Modified Files:
        tcpAddress.java 
Log Message:
6192:
Correct counting of SendFinished's for RNFs - if it's a failure, it's unreachable, if 
it's a timeout, it's "restarted".
Don't start a ConnJob in-thread if it's already been started by another thread.
Bugfixes to profiling counts of ConnectionHandler occurrences.
Pool ConnectionHandler accumulators too to avoid expensive allocations and object 
churn.
Include size of tcpConnection and ConnectionHandler buffer pools in interesting 
objects dump.
Logging.


Index: tcpAddress.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/tcpAddress.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- tcpAddress.java     29 Jul 2003 17:30:47 -0000      1.14
+++ tcpAddress.java     12 Sep 2003 01:52:26 -0000      1.15
@@ -23,12 +23,17 @@
     private InetAddress host;
     private String hostName = null;
     private int port;
+    private int hashCode; // has to be invariant with lookups etc
     public static boolean throttleAll = false;
 
     private String valname = "";
 
     private final tcpTransport transport;
-
+    
+    public int hashCode() {
+       return hashCode;
+    }
+    
     public boolean equals(tcpAddress tcp) {
        if(tcp == null) return false;
        if(tcp.port != port) return false;
@@ -58,10 +63,13 @@
         this(transport);
         setPort(port);
         this.host = host;
-       if(host!=null)
-               valname = host.getHostAddress();
-       else
-               valname = "";
+       if(host!=null) {
+           valname = host.getHostAddress();
+           hashCode = port ^ host.hashCode() ^ valname.hashCode();
+       } else {
+           hashCode = port;
+           valname = "";
+       }
     }
     
     /**
@@ -74,6 +82,7 @@
        hostName = hostname;
        host = null;
        //doDeferredLookup();
+       hashCode = port ^ hostname.hashCode();
         valname = hostname;
     }
 
@@ -96,8 +105,9 @@
             throw new BadAddressException(""+e);
         }
         setPort(Integer.parseInt(str.substring(colon + 1)));
+       hashCode = port ^ host.hashCode();
     }
-
+    
     public final void doDeferredLookup() throws UnknownHostException {
        if(host == null && hostName != null) {
            long startTime = System.currentTimeMillis();

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

Reply via email to