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

Modified Files:
        ConnectionHandler.java Core.java OpenConnectionManager.java 
        Ticker.java Version.java 
Log Message:
6163: Merge NGRouting
* Routing table switch: new config option routingTableImpl - "classic" or "ng"
* New diagnostics variables: normalizedSuccessTime, successSearchTime, 
successTransferRate, requestSuccessRatio, requestFailureRoutingOrNotRatio, 
routingSuccessRatio. These are reported by both RT modes, so should be usable for 
comparative purposes.
* Significant changes to Node Status Servlet, including a page with several graphs for 
each node in the RT.
* Significant changes to ConnectionOpener. Fixes to races that were causing 
RouteNotFound errors, a toString(), much more and better logging.
* Make a distinction between failed caching a DataReply due to IOE in the store and 
due to IOE on the stream when caching a DataReply. Use this in the code to make sure 
we respond correctly w.r.t. routing (it's more important in NGRouting).
* RoutingTable.route() now takes extra params: HTL, size, whether it is an insert. 
Added reportConnectionSuccess, reportConnectionFailure, used by ConnectionOpener to 
tell RT about connections.
* Major changes to the existing ResponseTimeEstimator class. Changed logic, changed 
serialization, changed interface, just about everything. Now implements the generic 
TimeEstimator, knows about time versus transfer rate versus probability, wraps around 
properly, has some significant algorithm changes.
* Change Routing interface significantly. Several new me methods, old ones have been 
given new arguments. Caller must for stats eventually call terminate(), or another 
terminal method (transferSuccess, dataNotFound). New base class, TerminatableRouting 
(implements Routing, base of NGRouting and TreeRouting), handles most of the stats.
* Add code all over states/ (mostly request, but also the others) for notifying the 
Routing of timings and status, terminating the Routing, some reporting bugfixes, get 
rid of the old "NGROUTING" debug log diagnostics.
* Lots of completely new code for NGRouting, mostly in freenet/node/rt/



Misc fixes etc
* Fix a deadlock in ConnectionHandler
* Iakin fix for 1.4.2 and later changed static initialization behaviour w.r.t. 
Core.params.
* Added messageSuccessRatio, tracks proportion of messages successfully sent
* Fix some NullPointerExceptions
* Spelling fixes to descriptions of diagnostic variables by Edward J. Huff
* Fixes to AbstractSelectorLoop.queueClose*, connection close notifications were being 
missed.
* Catch all throwables thrown by process() processing maintenance queue

Minor/future
* Notes on inserts (attacks, NGRouting)
* Give the ref to the GPL on the RNF page a filename
* Even more logging improvements
* More minor reindenting/restyling


Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- ConnectionHandler.java      22 Aug 2003 01:00:35 -0000      1.139
+++ ConnectionHandler.java      30 Aug 2003 23:16:50 -0000      1.140
@@ -469,6 +469,7 @@
                                        ByteBuffer a = accumulator;
                                        if(a == null) return -1; // closed already
                                        synchronized(a) {
+                                               if(accumulator == null) return -1;
                                                if(a.limit() + initialLimit >
                                                   a.capacity()) {
                                                        if(reregistering) {
@@ -593,7 +594,7 @@
                                                                if(processLen == -1)
                                                                        throw new 
IllegalStateException("Read -1 bytes but still got a message!");
                                                                if(logDEBUG) 
logDEBUG("Got Message: "+m.toString()+
-                                                                                      
                   ", clearing buffer after read. Message was:\n"+new 
String(_accumulator, 0, decryptLen));
+                                                                                      
                   ", clearing buffer after read. Message was:\n"+new 
String(_accumulator, 0, processLen));
                                                                
                                                                
accumulator.position(processLen);
                                                                
accumulator.compact().flip();
@@ -948,7 +949,9 @@
                        if (logDEBUG)Core.logger.log(this, "sendingQueue empty, 
trailingPresent "+trailingPresent,Logger.DEBUG);
                        currentSender=null;
                }*/
-               if (sendingQueue.size() >0) { // while because if one sfe's we need to 
go to next
+               boolean needTerminate = false; // don't terminate while holding locks!
+               if (sendingQueue.size() >0) { 
+                       // while because if one sfe's we need to go to next
                        int curPacketLength = 0;
                        synchronized(sentMessages) {
                                sentMessages.clear();
@@ -1035,26 +1038,31 @@
                                        }
                                        sendingCount = 0;
                                        if(receiveClosed.state() && receivingCount == 
0) {
-                                               terminate();
+                                               needTerminate = true;
                                        }
                                } catch (Throwable e) {
                                        Core.logger.log(this, "Caught "+e+" sending 
block", e,
                                                                        Logger.ERROR);
-                                       terminate();
+                                       needTerminate = true;
                                }
-                               // We have sent a packet. Yay.
-                               Core.logger.log(this, "Sent packet of size 
"+curPacketLength+
-                                                               " containing 
"+sentMessages.size()+" messages on "+
-                                                               this, Logger.MINOR);
-                               
Core.diagnostics.occurrenceContinuous("messagePacketSizeSent",
-                                                                                      
                   curPacketLength);
-                               
Core.diagnostics.occurrenceContinuous("messagesInPacketSent",
-                                                                                      
                   sentMessages.size());
-                       }
-               }
-               
-               if (logDEBUG) Core.logger.log(this,"exiting CH.jobDone(), size of 
sendQueue "+sendingQueue.size()+
-                                               " trailingPresent 
"+trailingPresent,Logger.DEBUG);      
+                               if(!needTerminate) {
+                                       // We have sent a packet. Yay.
+                                       Core.logger.log(this, "Sent packet of size "+
+                                                                       
curPacketLength+" containing "+
+                                                                       
sentMessages.size()+" messages on "+
+                                                                       this, 
Logger.MINOR);
+                               }
+                       }
+                       Core.diagnostics.occurrenceContinuous("messagePacketSizeSent",
+                                                                                      
           curPacketLength);
+                       Core.diagnostics.occurrenceContinuous("messagesInPacketSent",
+                                                                                      
           sentMessages.size());
+               }
+               if(needTerminate) terminate();
+               if (logDEBUG) Core.logger.log(this,"exiting CH.jobDone(), size "+
+                                                                         "of 
sendQueue "+sendingQueue.size()+
+                                                                         " 
trailingPresent "+trailingPresent,
+                                                                         
Logger.DEBUG);
                
        }
     
@@ -2002,7 +2010,10 @@
                        }
                        //log the total time in queue
                        long t = System.currentTimeMillis() - startTime;
-                       if(success && sfe == null) {
+                       if(sfe != null) success = false;
+                       Core.diagnostics.occurrenceBinomial("messageSuccessRatio", 1,
+                                                                                      
         success ? 1 : 0);
+                       if(success) {
                                
Core.diagnostics.occurrenceContinuous("messageSendTime", t);
                                if(identity != null && 
Main.node.rt.references(identity))
                                        Core.diagnostics.
@@ -2263,7 +2274,7 @@
                                                } catch (SendFailedException e) {
                                                        Core.logger.log(this, "Got 
IOException trying to "+
                                                                                       
 "sendMessage: "+this, e, 
-                                                                                      
 Logger.NORMAL);
+                                                                                      
 Logger.MINOR);
                                                        ms = null;
                                                        throw e;
                                                }

Index: Core.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Core.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Core.java   3 Jul 2003 03:33:41 -0000       1.39
+++ Core.java   30 Aug 2003 23:16:50 -0000      1.40
@@ -31,7 +31,7 @@
 
 public class Core {
 
-    public static final Config config = new Config();
+    private static final Config config = new Config();
     
     static {
         config.addOption("authTimeout",            1, 30000,  3100); // 30 sec
@@ -183,6 +183,28 @@
 
     /** Distribution of successful inbound InsertRequests over the keyspace **/
     public static KeyHistogram successInsertDistribution = null;
+
+       /**
+        * @return
+        */
+       public static Config getConfig() {
+               
+               try {
+                       //Enforce initialization of all of the 'freenet.node.Node' 
class:s static fields and scopes
+                       //'freenet.node.Node' uses static initialization to set up 
some config parameters,
+                       //this call forces this to happen *before* the first 
instanciation of 'freenet.node.Node' 
+                       //As of now (2003-08-27) 'freenet.node.Main' uses static 
members of 'freenet.node.Node'
+                       //before the first instanciation which wont work without this 
call 
+                       //Have a look at Sun BugID 4419673 for details.
+                       //TODO: Remove this hack when initialization order (or 
something) is changed
+                       Class.forName("freenet.node.Node"); 
+                        
+               } catch (ClassNotFoundException e) {
+                       //Really baaaad.. maybe someone renamed this class
+                       e.printStackTrace();
+               }
+               return config;
+       }
 
     /**
      * Returns the probability of success of a request that would go into

Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- OpenConnectionManager.java  22 Aug 2003 01:00:36 -0000      1.90
+++ OpenConnectionManager.java  30 Aug 2003 23:16:50 -0000      1.91
@@ -1014,6 +1014,8 @@
                                        }
                                        NIOInputStream niois = (NIOInputStream) 
                                                ((tcpConnection)c).getUnderlyingIn();
+                                       if(niois == null)
+                                               throw new IOException("Already closed 
- wierd...");
                                        niois.setNextReader(ch);
                                        tcpConnection.getRSL().unregister(niois);
                                        while(niois.isRegistered() && 

Index: Ticker.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Ticker.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Ticker.java 23 Jul 2003 14:44:37 -0000      1.17
+++ Ticker.java 30 Aug 2003 23:16:50 -0000      1.18
@@ -115,10 +115,16 @@
             synchronized (this) {
                                if(logDEBUG) timeLog("Synchronized in Ticker loop");
                 // prepare ready events for immediate execution
+                               int count=0;
                 while (events.size() > 0 && 
                        ((Event) events.top()).time() <= System.currentTimeMillis()) {
                                        if(logDEBUG) timeLog("Popping events from 
Ticker loop");
                                        Event e = (Event) events.pop();
+                                       if(logDEBUG) {
+                                               Core.logger.log(this, "Popped event 
"+count+": "+e,
+                                                                               
Logger.DEBUG);
+                                               count++;
+                                       }
                                        jobs.addElement(e);
                 }
                                if(logDEBUG) timeLog("No more events");

Index: Version.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Version.java,v
retrieving revision 1.355
retrieving revision 1.356
diff -u -r1.355 -r1.356
--- Version.java        22 Aug 2003 01:00:37 -0000      1.355
+++ Version.java        30 Aug 2003 23:16:50 -0000      1.356
@@ -18,7 +18,7 @@
     public static String protocolVersion = "1.46";
     
     /** The build number of the current revision */
-    public static final int buildNumber = 6162;
+    public static final int buildNumber = 6163;
     // 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