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

Modified Files:
        Identify.java Request.java 
Log Message:
6274:
Logging, toString(), try to catch a bizarre crash reported by hirvox, and wierd stuff 
with messages being delayed rather than dropped locally.
Verify Identify messages' NodeRefs
The connhandler ref takes precedence over the ref in the Request. If no connhandler 
ref, and the Request ref is signed, set the ref on the ConnHandler to the Request ref.
Basic idea is to cut verifications, which may have been killing the RSL.
Up lastGoodBuild to 6270.


Index: Identify.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/message/Identify.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- Identify.java       9 Oct 2003 00:23:40 -0000       1.3
+++ Identify.java       23 Oct 2003 18:12:36 -0000      1.4
@@ -23,8 +23,8 @@
        if(nodeRef == null) 
            throw new InvalidMessageException("No reference found");
        try {
-           // there is no reason to verify this.
-           sourceRef = new NodeReference(nodeRef, false, 
+           // Verify it so we can pass it on
+           sourceRef = new NodeReference(nodeRef, true, 
                                          source.peerIdentity());
        } catch (BadReferenceException e) {
            throw new InvalidMessageException("Failed to read NodeReference: "

Index: Request.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/message/Request.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -r1.13 -r1.14
--- Request.java        23 Oct 2003 00:09:41 -0000      1.13
+++ Request.java        23 Oct 2003 18:12:36 -0000      1.14
@@ -43,14 +43,23 @@
             searchKey     = Key.readKey(keyString);
             hopsToLive    = Fields.hexToInt(hopsString);
             // there is no reason to verify this.
-           if (nodeRef == null) {
-               requestSource = source.targetReference();
-               if(requestSource == null)
+           NodeReference ref = source.targetReference();
+           if (ref == null) {
+               Core.logger.log(this, "Getting requestSource from message: "+this+
+                               ","+nodeRef+" for "+source, Logger.MINOR);
+               if(nodeRef == null)
                    throw new InvalidMessageException("Can't find Source field");
-           } else {
-               requestSource = new NodeReference(nodeRef, false, true,
-                                                 source.peerIdentity());
+               ref = new NodeReference(nodeRef, false, true, source.peerIdentity());
+               if(ref.isSigned()) {
+                   source.setTargetReference(ref);
+                   Core.logger.log(this, "Set targetReference on "+source+" to "+ref,
+                                   Logger.DEBUG);
            }
+           } else if (nodeRef != null)
+               Core.logger.log(this, "Message "+this+" for "+source+" has "+
+                               nodeRef+" but conn has "+ref,
+                               Logger.MINOR);
+           requestSource = ref;
         } catch (KeyException k) {
             throw new InvalidMessageException("Failed to load key: " + k);
         } catch (NumberFormatException e) {
@@ -70,8 +79,12 @@
         raw.fs.add("HopsToLive", Fields.longToHex(hopsToLive));
        if(ch != null && ch.targetReference() != null) {
            // We have received Identify from them, so they will have ours too
-       } else
+       } else {
+           Core.logger.log(this, "Putting Source on message: "+this+
+                           " in toRawMessage("+t+","+ch+")",
+                           new Exception("debug"), Logger.MINOR);
            raw.fs.add("Source",     requestSource.getFieldSet(false));
+       }
         return raw;
     }
     

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

Reply via email to