Author: nextgens
Date: 2007-04-14 13:12:43 +0000 (Sat, 14 Apr 2007)
New Revision: 12679

Modified:
   trunk/freenet/src/freenet/node/fcp/ClientHelloMessage.java
   trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
   trunk/freenet/src/freenet/node/fcp/FCPMessage.java
Log:
Second step: we store it per connection handler

Modified: trunk/freenet/src/freenet/node/fcp/ClientHelloMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientHelloMessage.java  2007-04-14 
12:57:37 UTC (rev 12678)
+++ trunk/freenet/src/freenet/node/fcp/ClientHelloMessage.java  2007-04-14 
13:12:43 UTC (rev 12679)
@@ -41,7 +41,7 @@

        public void run(FCPConnectionHandler handler, Node node) {
                // We know the Hello is valid.
-               FCPMessage msg = new NodeHelloMessage(node);
+               FCPMessage msg = new NodeHelloMessage(node, handler);
                handler.outputHandler.queue(msg);
                handler.setClientName(clientName);
        }

Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java        
2007-04-14 12:57:37 UTC (rev 12678)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionHandler.java        
2007-04-14 13:12:43 UTC (rev 12679)
@@ -61,6 +61,7 @@
        private FCPClient client;
        final BucketFactory bf;
        final HashMap requestsByIdentifier;
+       private String connectionIdentifier;

        // We are confident that the given client can access those
        private final HashMap checkedDirectories = new HashMap();
@@ -404,4 +405,21 @@
                                ((DDACheckJob)it.next()).readFilename.delete();
                }
        }
+
+       /**
+        * Used in ClientPut as part of the hash of a DDA request
+        * @return the given identifier
+        */
+       protected String getConnectionIdentifier() {
+               return connectionIdentifier;
+       }
+
+       /**
+        * Should be set only once! and called from NodeHelloMessage
+        * @param connectionIdentifier
+        */
+       protected void setConnectionIdentifier(String connectionIdentifier) {
+               assert(connectionIdentifier == null);
+               this.connectionIdentifier = connectionIdentifier;
+       }
 }

Modified: trunk/freenet/src/freenet/node/fcp/FCPMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPMessage.java  2007-04-14 12:57:37 UTC 
(rev 12678)
+++ trunk/freenet/src/freenet/node/fcp/FCPMessage.java  2007-04-14 13:12:43 UTC 
(rev 12679)
@@ -85,8 +85,6 @@
                        return new WatchGlobal(fs);
                if(name.equals("Void"))
                        return null;
-               if(name.equals(NodeHelloMessage.NAME))
-                       return new NodeHelloMessage(fs);
                throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, "Unknown message 
name "+name, null, false);
        }



Reply via email to