Update of /cvsroot/freenet/freenet/src/freenet/node/states/FCP
In directory sc8-pr-cvs1:/tmp/cvs-serv25857/src/freenet/node/states/FCP

Modified Files:
      Tag: stable
        ClientGetToken.java ClientPutToken.java FCPFeedbackToken.java 
        NewClientGet.java NewClientPut.java NewClientRequest.java 
        NewFECDecodeSegment.java NewFECEncodeSegment.java 
        NewFECMakeMetadata.java NewFECSegmentFile.java 
        NewFECSegmentSplitFile.java NewGenerateCHK.java 
        NewGenerateSHA1.java NewGenerateSVKPair.java NewGetSize.java 
        NewHello.java NewIllegal.java NewInfo.java 
        NewInvertPrivateKey.java ReturnDiagnostics.java 
Log Message:
5029: Merge from unstable after months of work. MASSIVE changes.
Highlights:
* Next Generation Routing, massive related changes
* Major changes to handling of messages and connections (PeerHandler and related 
changes)
* Even more non-blocking I/O
* Documentation improvements
* Lots of new diagnostics and config options
* Lots of bug fixes and performance tweaking
* Probably lots of new bugs too!


Index: ClientGetToken.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/ClientGetToken.java,v
retrieving revision 1.4.6.4
retrieving revision 1.4.6.5
diff -u -w -r1.4.6.4 -r1.4.6.5
--- ClientGetToken.java 15 Aug 2003 03:05:49 -0000      1.4.6.4
+++ ClientGetToken.java 28 Oct 2003 20:20:41 -0000      1.4.6.5
@@ -29,7 +29,9 @@
     private OutputStream mdCopy = null;
     private BucketFactory bf = null;
     
-    ClientGetToken(long id, ConnectionHandler source, ClientKey ckey, 
+    // FIXME: convert to fully async
+    
+    ClientGetToken(long id, PeerHandler source, ClientKey ckey, 
                    boolean sendHint, FreenetURI uri, long timeSec,
                    BucketFactory bf) {
         super(id, source);
@@ -40,7 +42,7 @@
         this.bf = bf;
     }
 
-    public OutputStream dataFound(Node n, Storables sto, long ctLength)
+    public TrailerWriter dataFound(Node n, Storables sto, long ctLength)
                                             throws SendFailedException {
         waiting = false;
 
@@ -71,7 +73,7 @@
             sendMessage(msg);
             return null;
         } catch (KeyException e) {
-       if(!Core.logger.shouldLog(Logger.DEBUG))
+       if(!Core.logger.shouldLog(Logger.DEBUG,this))
            Core.logger.log(this, "ClientGetToken got "+e+" trying to decode a key",
                            Logger.MINOR);
        else
@@ -103,9 +105,9 @@
             if (doc.metadataLength() > 0)
                 fs.put("MetadataLength", Long.toHexString(doc.metadataLength()));
             sendMessage(new DataFound(id, fs));
-            return new CBStripOutputStream(out, ckey.getPartSize(), 
ckey.getControlLength());
-        }
-        catch (IOException e) {
+           out = new CBStripOutputStream(out, ckey.getPartSize(), 
ckey.getControlLength());
+           return new OutputStreamTrailerWriter(out);
+        } catch (IOException e) {
             sendMessage(new Failed(id, e.getMessage()));
             return null;
         }
@@ -127,16 +129,18 @@
         protected void sendChunk(int chunkSize) throws IOException {
             OutputStream out;
             try {
-                out = sendMessage(
-                                  new DataChunk(id, chunkSize, (pos == length) && 
!sendHint)
-                                      
-                                      );
-            }
-            catch (SendFailedException e) {
-                throw new IOException(e.getMessage());
+               TrailerWriter tw = 
+                   sendMessage(new DataChunk(id, chunkSize, (pos == length) && 
!sendHint));
+               if(tw == null) throw new NullPointerException();
+               out = new TrailerWriterOutputStream(tw);
+            } catch (SendFailedException e) {
+               IOException ex = new IOException(e.getMessage());
+               ex.initCause(e);
+               throw ex;
             }
             out.write(buffer, 0, chunkSize);
             out.flush();
+           out.close();
 
             if (sendHint && (pos == length)) {
                 // Send a the redirect hint after the data.
@@ -150,11 +154,9 @@
                     }
                     sendMessage(new MetadataHint(id, mdi,
                                                  uri, hasData, timeSec)); 
-                }
-                catch (SendFailedException e) {
+                } catch (SendFailedException e) {
                     throw new IOException(e.getMessage());
-                }
-                finally {
+                } finally {
                     if (metaData != null) {
                         bf.freeBucket(metaData);
                     }

Index: ClientPutToken.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/ClientPutToken.java,v
retrieving revision 1.2.6.2
retrieving revision 1.2.6.3
diff -u -w -r1.2.6.2 -r1.2.6.3
--- ClientPutToken.java 15 Aug 2003 03:05:49 -0000      1.2.6.2
+++ ClientPutToken.java 28 Oct 2003 20:20:41 -0000      1.2.6.3
@@ -14,11 +14,11 @@
     private String uri, priv, pub;
     private boolean keyCollision = false;
 
-    ClientPutToken(long id, ConnectionHandler source, String uri) {
+    ClientPutToken(long id, PeerHandler source, String uri) {
         this(id, source, uri, null, null);
     }
     
-    ClientPutToken(long id, ConnectionHandler source,
+    ClientPutToken(long id, PeerHandler source,
                    String uri, String priv, String pub) {
         super(id, source);
         this.uri  = uri;
@@ -34,7 +34,7 @@
         return fs;
     }
     
-    public OutputStream dataFound(Node n, Storables storables, long ctLength)
+    public TrailerWriter dataFound(Node n, Storables storables, long ctLength)
                                                 throws SendFailedException {
         keyCollision = true;
         sendMessage(new KeyCollision(id, getFields()));

Index: FCPFeedbackToken.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/FCPFeedbackToken.java,v
retrieving revision 1.2.6.1
retrieving revision 1.2.6.2
diff -u -w -r1.2.6.1 -r1.2.6.2
--- FCPFeedbackToken.java       15 Aug 2003 03:05:49 -0000      1.2.6.1
+++ FCPFeedbackToken.java       28 Oct 2003 20:20:41 -0000      1.2.6.2
@@ -13,18 +13,19 @@
 
     // the id of the associated state chain
     long id;
-    // the active connection
-    protected ConnectionHandler source;
+    // the active connection (message queue)
+    protected PeerHandler source;
 
     protected boolean waiting = true;
 
-    FCPFeedbackToken(long id, ConnectionHandler source) {
+    FCPFeedbackToken(long id, PeerHandler source) {
         this.id     = id;
         this.source = source;
     }
 
     public void queryRejected(Node n, int htl, String reason, FieldSet fs,
-                              int unreachable, int restarted, int rejected)
+                              int unreachable, int restarted, int rejected,
+                             MessageSendCallback cb)
                                                 throws SendFailedException {
         if (waiting)
             sendMessage(new RouteNotFound(id, reason, unreachable,
@@ -33,7 +34,8 @@
             sendMessage(new Failed(id, reason));
     }
 
-    public void restarted(Node n, long millis) throws SendFailedException {
+    public void restarted(Node n, long millis,
+                         MessageSendCallback cb) throws SendFailedException {
         waiting = true;
         sendMessage(new Restarted(id, millis));
     }
@@ -44,7 +46,8 @@
         sendMessage(new DataNotFound(id));
     }
     
-    protected OutputStream sendMessage(ClientMessage cm) throws SendFailedException {
+    // FIXME: implement async sending here
+    protected TrailerWriter sendMessage(ClientMessage cm) throws SendFailedException {
         return source.sendMessage(cm);
     }
 }

Index: NewClientGet.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewClientGet.java,v
retrieving revision 1.6.4.1.2.1
retrieving revision 1.6.4.1.2.2
diff -u -w -r1.6.4.1.2.1 -r1.6.4.1.2.2
--- NewClientGet.java   4 Apr 2003 22:58:01 -0000       1.6.4.1.2.1
+++ NewClientGet.java   28 Oct 2003 20:20:41 -0000      1.6.4.1.2.2
@@ -18,7 +18,7 @@
     private FreenetURI uri = null;
     private long timeSec = -1;
 
-    public NewClientGet(long id, ConnectionHandler source,
+    public NewClientGet(long id, PeerHandler source,
                         boolean sendHint, FreenetURI uri,
                         long timeSec) {
         super(id, source);

Index: NewClientPut.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewClientPut.java,v
retrieving revision 1.6.6.2
retrieving revision 1.6.6.3
diff -u -w -r1.6.6.2 -r1.6.6.3
--- NewClientPut.java   1 Jul 2003 02:27:16 -0000       1.6.6.2
+++ NewClientPut.java   28 Oct 2003 20:20:41 -0000      1.6.6.3
@@ -18,7 +18,7 @@
 
 public class NewClientPut extends NewClientRequest {
 
-    public NewClientPut(long id, ConnectionHandler source) {
+    public NewClientPut(long id, PeerHandler source) {
         super(id, source);
     }
     
@@ -56,7 +56,7 @@
             // initialize the ClientKey
             FreenetURI uri = cpmo.getURI();
             ClientKey ckey = 
-                AbstractClientKey.createFromInsertURI(n.randSource, uri);
+                AbstractClientKey.createFromInsertURI(n.getRandSource(), uri);
             
             String cipher = cpmo.otherFields.get("Cipher");
             if (cipher != null) ckey.setCipher(cipher);

Index: NewClientRequest.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewClientRequest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.6.1
diff -u -w -r1.1.1.1 -r1.1.1.1.6.1
--- NewClientRequest.java       13 Jan 2002 05:24:47 -0000      1.1.1.1
+++ NewClientRequest.java       28 Oct 2003 20:20:41 -0000      1.1.1.1.6.1
@@ -8,9 +8,9 @@
 
 public abstract class NewClientRequest extends State {
 
-    protected ConnectionHandler source;
+    protected PeerHandler source;
     
-    protected NewClientRequest(long id, ConnectionHandler source) {
+    protected NewClientRequest(long id, PeerHandler source) {
         super(id);
         this.source = source;
     }

Index: NewFECDecodeSegment.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewFECDecodeSegment.java,v
retrieving revision 1.1.4.1.2.2
retrieving revision 1.1.4.1.2.3
diff -u -w -r1.1.4.1.2.2 -r1.1.4.1.2.3
--- NewFECDecodeSegment.java    5 Jul 2003 01:09:55 -0000       1.1.4.1.2.2
+++ NewFECDecodeSegment.java    28 Oct 2003 20:20:41 -0000      1.1.4.1.2.3
@@ -14,7 +14,7 @@
 
 public class NewFECDecodeSegment extends NewClientRequest {
 
-    public NewFECDecodeSegment(long id, ConnectionHandler source) {
+    public NewFECDecodeSegment(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewFECEncodeSegment.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewFECEncodeSegment.java,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -w -r1.1.6.1 -r1.1.6.2
--- NewFECEncodeSegment.java    1 Jul 2003 02:27:16 -0000       1.1.6.1
+++ NewFECEncodeSegment.java    28 Oct 2003 20:20:41 -0000      1.1.6.2
@@ -16,7 +16,7 @@
 
 public class NewFECEncodeSegment extends NewClientRequest {
 
-    public NewFECEncodeSegment(long id, ConnectionHandler source) {
+    public NewFECEncodeSegment(long id, PeerHandler source) {
         super(id, source);
     }
     
@@ -211,7 +211,7 @@
 
     // REDFLAG: test!
     // REDFLAG: move
-    protected static void sendDataChunks(ConnectionHandler source, long id,
+    protected static void sendDataChunks(PeerHandler source, long id,
                                          Bucket[] data, long length, int chunkSize)
         throws IOException {
 
@@ -267,20 +267,22 @@
         }
     }
 
-    protected  static void sendChunk(ConnectionHandler source, long id,
+    protected  static void sendChunk(PeerHandler source, long id,
                                      byte[] buffer, long size, boolean close) 
         throws IOException {
 
         OutputStream out;
         try {
             // hmmm... correct?
-            out = source.sendMessage( new DataChunk(id, size, close));
-        }
-        catch (SendFailedException e) {
+            TrailerWriter tw = source.sendMessage( new DataChunk(id, size, close));
+           if(tw == null) throw new IOException("wtf?");
+           out = new TrailerWriterOutputStream(tw);
+        } catch (SendFailedException e) {
             throw new IOException(e.getMessage());
         }
         out.write(buffer, 0, (int)size);
         out.flush();
+       out.close();
     }
 }
 

Index: NewFECMakeMetadata.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewFECMakeMetadata.java,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.2.2.1
diff -u -w -r1.1.4.2 -r1.1.4.2.2.1
--- NewFECMakeMetadata.java     24 Jan 2003 23:50:00 -0000      1.1.4.2
+++ NewFECMakeMetadata.java     28 Oct 2003 20:20:41 -0000      1.1.4.2.2.1
@@ -13,7 +13,7 @@
 
 public class NewFECMakeMetadata extends NewClientRequest {
 
-    public NewFECMakeMetadata(long id, ConnectionHandler source) {
+    public NewFECMakeMetadata(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewFECSegmentFile.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewFECSegmentFile.java,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -w -r1.1 -r1.1.6.1
--- NewFECSegmentFile.java      14 Sep 2002 22:42:18 -0000      1.1
+++ NewFECSegmentFile.java      28 Oct 2003 20:20:41 -0000      1.1.6.1
@@ -7,7 +7,7 @@
 
 public class NewFECSegmentFile extends NewClientRequest {
 
-    public NewFECSegmentFile(long id, ConnectionHandler source) {
+    public NewFECSegmentFile(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewFECSegmentSplitFile.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewFECSegmentSplitFile.java,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -w -r1.1.4.1 -r1.1.4.1.2.1
--- NewFECSegmentSplitFile.java 9 Jan 2003 01:42:36 -0000       1.1.4.1
+++ NewFECSegmentSplitFile.java 28 Oct 2003 20:20:41 -0000      1.1.4.1.2.1
@@ -13,7 +13,7 @@
 
 public class NewFECSegmentSplitFile extends NewClientRequest {
 
-    public NewFECSegmentSplitFile(long id, ConnectionHandler source) {
+    public NewFECSegmentSplitFile(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewGenerateCHK.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewGenerateCHK.java,v
retrieving revision 1.1.1.1.6.1
retrieving revision 1.1.1.1.6.2
diff -u -w -r1.1.1.1.6.1 -r1.1.1.1.6.2
--- NewGenerateCHK.java 23 Jul 2003 01:56:53 -0000      1.1.1.1.6.1
+++ NewGenerateCHK.java 28 Oct 2003 20:20:41 -0000      1.1.1.1.6.2
@@ -10,7 +10,7 @@
 
 public class NewGenerateCHK extends NewClientRequest {
 
-    public NewGenerateCHK(long id, ConnectionHandler source) {
+    public NewGenerateCHK(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewGenerateSHA1.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewGenerateSHA1.java,v
retrieving revision 1.1.2.1.2.1
retrieving revision 1.1.2.1.2.2
diff -u -w -r1.1.2.1.2.1 -r1.1.2.1.2.2
--- NewGenerateSHA1.java        21 May 2003 19:54:49 -0000      1.1.2.1.2.1
+++ NewGenerateSHA1.java        28 Oct 2003 20:20:41 -0000      1.1.2.1.2.2
@@ -10,7 +10,7 @@
 
 public class NewGenerateSHA1 extends NewClientRequest {
 
-    public NewGenerateSHA1(long id, ConnectionHandler source) {
+    public NewGenerateSHA1(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: NewGenerateSVKPair.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewGenerateSVKPair.java,v
retrieving revision 1.1.1.1.6.2
retrieving revision 1.1.1.1.6.3
diff -u -w -r1.1.1.1.6.2 -r1.1.1.1.6.3
--- NewGenerateSVKPair.java     23 Jul 2003 01:56:53 -0000      1.1.1.1.6.2
+++ NewGenerateSVKPair.java     28 Oct 2003 20:20:41 -0000      1.1.1.1.6.3
@@ -8,7 +8,7 @@
 
 public class NewGenerateSVKPair extends NewClientRequest {
 
-    public NewGenerateSVKPair(long id, ConnectionHandler source) {
+    public NewGenerateSVKPair(long id, PeerHandler source) {
         super(id, source);
     }
     
@@ -21,7 +21,7 @@
             throw new BadStateException("expecting GenerateSVKPair");
        ClientSVK svk;
        try {
-           svk = new ClientSVK(n.randSource);
+           svk = new ClientSVK(n.getRandSource());
        } catch (KeyException e) {
            Core.logger.log(this, "KeyException creating ClientSVK: "+e, e, 
Logger.ERROR);
            sendMessage(new Failed(id, "Internal Error: KeyException creating 
ClientSVK: "+e));
@@ -31,7 +31,7 @@
         fs.put("PrivateKey", Base64.encode(svk.getPrivateKey()));
         fs.put("PublicKey",  Base64.encode(svk.getPublicKeyFingerPrint()));
        byte[] cryptoKey = new byte[16]; // 64 bits should be plenty
-       n.randSource.nextBytes(cryptoKey);
+       n.getRandSource().nextBytes(cryptoKey);
        fs.put("CryptoKey",  Base64.encode(cryptoKey));
         sendMessage(new Success(id, fs));
         return null;

Index: NewGetSize.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewGetSize.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -r1.1.2.1 -r1.1.2.2
--- NewGetSize.java     23 Jul 2003 13:43:54 -0000      1.1.2.1
+++ NewGetSize.java     28 Oct 2003 20:20:42 -0000      1.1.2.2
@@ -17,7 +17,7 @@
 
 public class NewGetSize extends NewClientRequest {
     
-    public NewGetSize(long id, ConnectionHandler source) {
+    public NewGetSize(long id, PeerHandler source) {
        super(id, source);
     }
     

Index: NewHello.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewHello.java,v
retrieving revision 1.2.4.2
retrieving revision 1.2.4.2.2.1
diff -u -w -r1.2.4.2 -r1.2.4.2.2.1
--- NewHello.java       18 Mar 2003 03:49:30 -0000      1.2.4.2
+++ NewHello.java       28 Oct 2003 20:20:42 -0000      1.2.4.2.2.1
@@ -5,10 +5,11 @@
 import freenet.message.client.*;
 import freenet.node.ds.FSDataStore;
 import freenet.support.Fields;
+import freenet.support.Logger;
 
 public class NewHello extends NewClientRequest {
 
-    public NewHello(long id, ConnectionHandler source) {
+    public NewHello(long id, PeerHandler source) {
         super(id, source);
     }
     
@@ -19,14 +20,20 @@
     public State received(Node n, MessageObject mo) throws BadStateException {
         if (!(mo instanceof ClientHello))
             throw new BadStateException("expecting ClientHello");
+       boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+       if(logDEBUG)
+           Core.logger.log(this, "Running ClientHello: "+mo+" on "+this,
+                           Logger.DEBUG);
         FieldSet fs = new FieldSet();
         fs.add("Node", Version.getVersionString());
         fs.add("Protocol", "1.2");
-       fs.add("MaxFileSize", Fields.longToString(((FSDataStore)(n.ds)).maxDataSize));
+       fs.add("MaxFileSize", Fields.longToHex(((FSDataStore)(n.ds)).maxDataSize));
        if (Version.highestSeenBuild > Version.buildNumber) {
             fs.add("HighestSeenBuild", ""+Version.highestSeenBuild);
        }
         sendMessage(new NodeHello(id, fs));
+       if(logDEBUG) Core.logger.log(this, "Finished running ClientHello "+
+                                    mo+" on "+this, Logger.DEBUG);
         return null;
     }
 }

Index: NewIllegal.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewIllegal.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.6.1
diff -u -w -r1.1.1.1 -r1.1.1.1.6.1
--- NewIllegal.java     13 Jan 2002 05:24:47 -0000      1.1.1.1
+++ NewIllegal.java     28 Oct 2003 20:20:42 -0000      1.1.1.1.6.1
@@ -8,11 +8,11 @@
 
     private String reason;
 
-    public NewIllegal(long id, ConnectionHandler source) {
+    public NewIllegal(long id, PeerHandler source) {
         super(id, source);
     }
 
-    public NewIllegal(long id, ConnectionHandler source, String reason) {
+    public NewIllegal(long id, PeerHandler source, String reason) {
         super(id, source);
         this.reason = reason;
     }

Index: NewInfo.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewInfo.java,v
retrieving revision 1.1.2.4.2.1
retrieving revision 1.1.2.4.2.2
diff -u -w -r1.1.2.4.2.1 -r1.1.2.4.2.2
--- NewInfo.java        21 May 2003 19:54:49 -0000      1.1.2.4.2.1
+++ NewInfo.java        28 Oct 2003 20:20:42 -0000      1.1.2.4.2.2
@@ -15,7 +15,7 @@
 
 public class NewInfo extends NewClientRequest {
 
-    public NewInfo(long id, ConnectionHandler source) {
+    public NewInfo(long id, PeerHandler source) {
         super(id, source);
     }
     
@@ -28,7 +28,7 @@
             throw new BadStateException("expecting ClientInfo");
         FieldSet fs = new FieldSet();
                
-               fs.add("EstimatedLoad", Fields.longToString((long)(n.estimatedLoad() * 
100)));
+               fs.add("EstimatedLoad", Fields.longToHex((long)(n.estimatedLoad() * 
100)));
                
                fs.add("IsTransient", n.isTransient() ? "true" : "false");
                
@@ -68,24 +68,24 @@
                } catch (Throwable e) { }
        
                try {
-                       fs.add("AllocatedMemory", 
Fields.longToString((long)(Runtime.getRuntime().totalMemory())));
+                       fs.add("AllocatedMemory", 
Fields.longToHex((long)(Runtime.getRuntime().totalMemory())));
                } catch (Throwable e) { }
        
                try {
-                       fs.add("FreeMemory", 
Fields.longToString((long)(Runtime.getRuntime().freeMemory())));
+                       fs.add("FreeMemory", 
Fields.longToHex((long)(Runtime.getRuntime().freeMemory())));
                } catch (Throwable e) { }
        
-               fs.add("DatastoreMax", 
Fields.longToString((long)(n.storeSize*n.storeFile.length)));
-               fs.add("DatastoreFree", 
Fields.longToString((long)(n.dir.available())));
-               fs.add("DatastoreUsed", 
Fields.longToString((long)(n.storeSize*n.storeFile.length - n.dir.available())));
-               fs.add("MaxFileSize", 
Fields.longToString(((FSDataStore)(n.ds)).maxDataSize));
-               fs.add("MostRecentTimestamp", 
Fields.longToString((long)((NativeFSDirectory)n.dir).mostRecentlyUsedTime()));
-               fs.add("LeastRecentTimestamp", 
Fields.longToString((long)((NativeFSDirectory)n.dir).leastRecentlyUsedTime()));
+               fs.add("DatastoreMax", 
Fields.longToHex((long)(n.storeSize*n.storeFile.length)));
+               fs.add("DatastoreFree", Fields.longToHex((long)(n.dir.available())));
+               fs.add("DatastoreUsed", 
Fields.longToHex((long)(n.storeSize*n.storeFile.length - n.dir.available())));
+               fs.add("MaxFileSize", 
Fields.longToHex(((FSDataStore)(n.ds)).maxDataSize));
+               fs.add("MostRecentTimestamp", 
Fields.longToHex((long)((NativeFSDirectory)n.dir).mostRecentlyUsedTime()));
+               fs.add("LeastRecentTimestamp", 
Fields.longToHex((long)((NativeFSDirectory)n.dir).leastRecentlyUsedTime()));
        
-               fs.add("RoutingTime", 
Fields.longToString((long)(n.diagnostics.getValue("routingTime", Diagnostics.MINUTE, 
Diagnostics.MEAN_VALUE))));
+               fs.add("RoutingTime", 
Fields.longToHex((long)(n.diagnostics.getValue("routingTime", Diagnostics.MINUTE, 
Diagnostics.MEAN_VALUE))));
                
-               fs.add("AvailableThreads", Fields.longToString(n.availableThreads()));
-               fs.add("ActiveJobs", Fields.longToString(n.activeJobs()));
+               fs.add("AvailableThreads", Fields.longToHex(n.availableThreads()));
+               fs.add("ActiveJobs", Fields.longToHex(n.activeJobs()));
 
                tcpAddress tcp = Main.getTcpAddress();
                if(tcp!=null) {
@@ -98,7 +98,7 @@
                                addr = tcp.getValName();
                        }
                        fs.add("NodeAddress", addr);
-                       fs.add("NodePort", Fields.longToString((long)tcp.getPort()));
+                       fs.add("NodePort", Fields.longToHex((long)tcp.getPort()));
                }
        
                // FIXME: add thread stats stuff here when I work it out ^_^

Index: NewInvertPrivateKey.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/FCP/NewInvertPrivateKey.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -r1.1.2.1 -r1.1.2.2
--- NewInvertPrivateKey.java    11 Apr 2003 00:01:40 -0000      1.1.2.1
+++ NewInvertPrivateKey.java    28 Oct 2003 20:20:42 -0000      1.1.2.2
@@ -14,7 +14,7 @@
  */
 public class NewInvertPrivateKey extends NewClientRequest {
 
-    public NewInvertPrivateKey(long id, ConnectionHandler source) {
+    public NewInvertPrivateKey(long id, PeerHandler source) {
         super(id, source);
     }
     

Index: ReturnDiagnostics.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FCP/ReturnDiagnostics.java,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -w -r1.2 -r1.2.6.1
--- ReturnDiagnostics.java      6 Feb 2002 10:13:38 -0000       1.2
+++ ReturnDiagnostics.java      28 Oct 2003 20:20:42 -0000      1.2.6.1
@@ -16,7 +16,7 @@
 
 public class ReturnDiagnostics extends NewClientRequest {
 
-    public ReturnDiagnostics(long id, ConnectionHandler source) {
+    public ReturnDiagnostics(long id, PeerHandler source) {
         super(id, source);
     }
 
@@ -32,9 +32,10 @@
             n.diagnostics.writeVars(bout, new FieldSetFormat());
             bout.close();
 
-            OutputStream out = 
+            TrailerWriter tw = 
                 source.sendMessage(new DiagnosticsReply(id, bucket.size()));
-            if (out != null) {
+            if (tw != null) {
+               OutputStream out = new TrailerWriterOutputStream(tw);
                 byte[] b = new byte[Core.blockSize];
                 int i;
                 InputStream in = bucket.getInputStream();

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

Reply via email to