Author: nextgens
Date: 2008-08-12 20:45:33 +0000 (Tue, 12 Aug 2008)
New Revision: 21774

Modified:
   trunk/freenet/src/freenet/io/comm/DMT.java
   trunk/freenet/src/freenet/node/NodeDispatcher.java
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
Get rid of the old FNPLocationChange message now that 1154 is mandatory

Modified: trunk/freenet/src/freenet/io/comm/DMT.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/DMT.java  2008-08-12 19:42:51 UTC (rev 
21773)
+++ trunk/freenet/src/freenet/io/comm/DMT.java  2008-08-12 20:45:33 UTC (rev 
21774)
@@ -1206,18 +1206,6 @@
                msg.set(DATA, new ShortBuffer(buf));
                return msg;
        }
-
-       @Deprecated
-       public static final MessageType FNPLocChangeNotification = new 
MessageType("FNPLocationChangeNotification", PRIORITY_LOW) {{
-               addField(LOCATION, Double.class);
-       }};
-       
-       @Deprecated
-       public static final Message createFNPLocChangeNotification(double 
newLoc) {
-               Message msg = new Message(FNPLocChangeNotification);
-               msg.set(LOCATION, newLoc);
-               return msg;
-       }

        public static final MessageType FNPLocChangeNotificationNew = new 
MessageType("FNPLocationChangeNotification2", PRIORITY_LOW) {{
                addField(LOCATION, Double.class);

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-08-12 19:42:51 UTC 
(rev 21773)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-08-12 20:45:33 UTC 
(rev 21774)
@@ -143,13 +143,6 @@
                        }
                        // We claim it in any case
                        return true;
-               } else if(source.isRealConnection() && spec == 
DMT.FNPLocChangeNotification) {
-                       double newLoc = m.getDouble(DMT.LOCATION);
-                       source.updateLocation(newLoc);
-                       // TODO: remove dead code when 
FNPLocChangeNotificationNew is mandatory
-                       if(source.getVersionNumber() > 1153)
-                               Logger.error(this, "We received a 
FNPLocChangeNotification from a recent build: that should *not* happen! 
("+source.toString()+')');
-                       return true;
                } else if(source.isRealConnection() && spec == 
DMT.FNPLocChangeNotificationNew) {
                        double newLoc = m.getDouble(DMT.LOCATION);
                        ShortBuffer buffer = ((ShortBuffer) 
m.getObject(DMT.PEER_LOCATIONS));

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2008-08-12 19:42:51 UTC 
(rev 21773)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2008-08-12 20:45:33 UTC 
(rev 21774)
@@ -1620,24 +1620,6 @@
                        }
                }
        }
-
-       /**
-       * Update the Location to a new value.
-       * @deprecated
-       */
-       public void updateLocation(double newLoc) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, PeerNode.class);
-               if(newLoc < 0.0 || newLoc > 1.0) {
-                       Logger.error(this, "Invalid location update for " + 
this+ " ("+newLoc+')', new Exception("error"));
-                       // Ignore it
-                       return;
-               }
-               synchronized(this) {
-                       currentLocation = newLoc;
-                       locSetTime = System.currentTimeMillis();
-               }
-               node.peers.writePeers();
-       }

        public void updateLocation(double newLoc, double[] newLocs) {
                logMINOR = Logger.shouldLog(Logger.MINOR, PeerNode.class);
@@ -2122,14 +2104,12 @@
        * Send any high level messages that need to be sent on connect.
        */
        protected void sendInitialMessages() {
-               Message locMsg = ((getVersionNumber() > 1153) ?
-                       
DMT.createFNPLocChangeNotificationNew(node.lm.getLocation(), 
node.peers.getPeerLocationDoubles(true)) :
-                       
DMT.createFNPLocChangeNotification(node.lm.getLocation()));
+               Message locMsg = 
DMT.createFNPLocChangeNotificationNew(node.lm.getLocation(), 
node.peers.getPeerLocationDoubles(true));
                Message ipMsg = DMT.createFNPDetectedIPAddress(detectedPeer);
                Message timeMsg = DMT.createFNPTime(System.currentTimeMillis());
                Message packetsMsg = createSentPacketsMessage();
-               Message dRouting = 
DMT.createRoutingStatus(!disableRoutingHasBeenSetLocally);
-               Message uptime = 
DMT.createFNPUptime((byte)(int)(100*node.uptime.getUptime()));
+               Message dRoutingMsg = 
DMT.createRoutingStatus(!disableRoutingHasBeenSetLocally);
+               Message uptimeMsg = 
DMT.createFNPUptime((byte)(int)(100*node.uptime.getUptime()));

                try {
                        if(isRealConnection())
@@ -2137,8 +2117,8 @@
                        sendAsync(ipMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
                        sendAsync(timeMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
                        sendAsync(packetsMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
-                       sendAsync(dRouting, null, 0, 
node.nodeStats.initialMessagesCtr);
-                       sendAsync(uptime, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(dRoutingMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(uptimeMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
                } catch(NotConnectedException e) {
                        Logger.error(this, "Completed handshake with " + 
getPeer() + " but disconnected (" + isConnected + ':' + currentTracker + "!!!: 
" + e, e);
                }


Reply via email to