Author: zothar
Date: 2008-01-06 20:51:49 +0000 (Sun, 06 Jan 2008)
New Revision: 16949

Modified:
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
indent

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2008-01-06 20:48:38 UTC 
(rev 16948)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2008-01-06 20:51:49 UTC 
(rev 16949)
@@ -280,20 +280,19 @@
        final WeakReference myRef;
        /** The node is being disconnected, but it may take a while. */
        private boolean disconnecting;
-    /** When did we last disconnect? Not Disconnected because a discrete event 
*/
-    long timeLastDisconnect;
-    /** Previous time of disconnection */
-    long timePrevDisconnect;
-    
-    // Burst-only mode
-    /** True if we are currently sending this peer a burst of handshake 
requests */
-    private boolean isBursting;
-    /** Number of handshake attempts (while in ListenOnly mode) since the 
beginning of this burst */
-    private int listeningHandshakeBurstCount;
-    /** Total number of handshake attempts (while in ListenOnly mode) to be in 
this burst */
-    private int listeningHandshakeBurstSize;
-    
-    
+       /** When did we last disconnect? Not Disconnected because a discrete 
event */
+       long timeLastDisconnect;
+       /** Previous time of disconnection */
+       long timePrevDisconnect;
+       
+       // Burst-only mode
+       /** True if we are currently sending this peer a burst of handshake 
requests */
+       private boolean isBursting;
+       /** Number of handshake attempts (while in ListenOnly mode) since the 
beginning of this burst */
+       private int listeningHandshakeBurstCount;
+       /** Total number of handshake attempts (while in ListenOnly mode) to be 
in this burst */
+       private int listeningHandshakeBurstSize;
+       
        /**
         * For FNP link setup:
         *  The initiator has to ensure that nonces send back by the
@@ -626,13 +625,13 @@
                lastAttemptedHandshakeIPUpdateTime = 0;
                maybeUpdateHandshakeIPs(true);

-        listeningHandshakeBurstCount = 0;
-        listeningHandshakeBurstSize = Node.MIN_BURSTING_HANDSHAKE_BURST_SIZE
-               + 
node.random.nextInt(Node.RANDOMIZED_BURSTING_HANDSHAKE_BURST_SIZE);
+               listeningHandshakeBurstCount = 0;
+               listeningHandshakeBurstSize = 
Node.MIN_BURSTING_HANDSHAKE_BURST_SIZE
+                       + 
node.random.nextInt(Node.RANDOMIZED_BURSTING_HANDSHAKE_BURST_SIZE);

-        if(isBurstOnly()) {
-               Logger.minor(this, "First BurstOnly mode handshake in 
"+(sendHandshakeTime - now)+"ms for "+shortToString()+" (count: 
"+listeningHandshakeBurstCount+", size: "+listeningHandshakeBurstSize+ ')');
-        }
+               if(isBurstOnly()) {
+                       Logger.minor(this, "First BurstOnly mode handshake in 
"+(sendHandshakeTime - now)+"ms for "+shortToString()+" (count: 
"+listeningHandshakeBurstCount+", size: "+listeningHandshakeBurstSize+ ')');
+               }

                if(fromLocal)
                        innerCalcNextHandshake(false, false, now); // Let them 
connect so we can recognise we are NATed
@@ -760,7 +759,7 @@
                synchronized(this) {
                        localDetectedPeer = detectedPeer;
                        if((now - lastAttemptedHandshakeIPUpdateTime) < (5 * 60 
* 1000)) {  // 5 minutes
-                       //Logger.minor(this, "Looked up recently 
(localDetectedPeer = "+localDetectedPeer + " : "+((localDetectedPeer == null) ? 
"" : localDetectedPeer.getAddress(false).toString()));
+                               //Logger.minor(this, "Looked up recently 
(localDetectedPeer = "+localDetectedPeer + " : "+((localDetectedPeer == null) ? 
"" : localDetectedPeer.getAddress(false).toString()));
                                return;
                        }
                        // We want to come back right away for DNS requesting 
if this is our first time through
@@ -956,8 +955,8 @@
                        node.ps.wakeUp();
                }
                // Otherwise we do not need to wake up the PacketSender
-        // It will wake up before the maximum coalescing delay (100ms) because
-        // it wakes up every 100ms *anyway*.
+               // It will wake up before the maximum coalescing delay (100ms) 
because
+               // it wakes up every 100ms *anyway*.
        }

        public long getMessageQueueLengthBytes() {
@@ -1068,10 +1067,10 @@
                        }
                        // Else DO NOT clear trackers, because hopefully it's a 
temporary connectivity glitch.
                        sendHandshakeTime = now;
-               synchronized(this) {
-                       timePrevDisconnect = timeLastDisconnect;
-                       timeLastDisconnect = now;
-               }
+                       synchronized(this) {
+                               timePrevDisconnect = timeLastDisconnect;
+                               timeLastDisconnect = now;
+                       }
                        if(dumpMessageQueue) {
                                synchronized(messagesToSendNow) {
                                        messagesToSendNow.clear();
@@ -1194,13 +1193,13 @@
                if(tempShouldSendHandshake && (hasLiveHandshake(now)))
                        tempShouldSendHandshake = false;
                if(tempShouldSendHandshake) {
-               if(isBurstOnly()) {
-                       synchronized(this) {
-                               isBursting = true;
-                       }
-                       setPeerNodeStatus(System.currentTimeMillis());
-               } else
-                       return true;
+                       if(isBurstOnly()) {
+                               synchronized(this) {
+                                       isBursting = true;
+                               }
+                               setPeerNodeStatus(System.currentTimeMillis());
+                       } else
+                               return true;
                }
                return tempShouldSendHandshake;
        }
@@ -1848,7 +1847,7 @@
                        timeDeltas[i] = (int) (now - times[i]);
                if(skip != 0) {
                        // Unlikely code path, only happens with very long 
uptime.
-               // Trim hashes too.
+                       // Trim hashes too.
                        long[] newHashes = new long[hashes.length - skip];
                        System.arraycopy(hashes, skip, newHashes, 0, 
hashes.length - skip);
                }
@@ -2073,9 +2072,9 @@
                                        }
                                        if(!nominalPeer.contains(p)) {
                                                if(oldNominalPeer.contains(p)) {
-                                               // Do nothing
-                                               // .contains() will .equals() 
on each, and equals() will propagate the looked-up IP if necessary.
-                                               // This is obviously O(n^2), 
but it doesn't matter, there will be very few peers.
+                                                       // Do nothing
+                                                       // .contains() will 
.equals() on each, and equals() will propagate the looked-up IP if necessary.
+                                                       // This is obviously 
O(n^2), but it doesn't matter, there will be very few peers.
                                                }
                                                nominalPeer.addElement(p);
                                        }
@@ -2087,19 +2086,19 @@
                }

                if(!forDiffNodeRef || refHadPhysicalUDP) {
-               if(!Arrays.equals(oldPeers, nominalPeer.toArray(new 
Peer[nominalPeer.size()]))) {
-                       changedAnything = true;
-                       lastAttemptedHandshakeIPUpdateTime = 0;
-                       // Clear nonces to prevent leak. Will kill any 
in-progress connect attempts, but that is okay because
-                       // either we got an ARK which changed our peers list, 
or we just connected.
-                       jfkNoncesSent.clear();
-               }
+                       if(!Arrays.equals(oldPeers, nominalPeer.toArray(new 
Peer[nominalPeer.size()]))) {
+                               changedAnything = true;
+                               lastAttemptedHandshakeIPUpdateTime = 0;
+                               // Clear nonces to prevent leak. Will kill any 
in-progress connect attempts, but that is okay because
+                               // either we got an ARK which changed our peers 
list, or we just connected.
+                               jfkNoncesSent.clear();
+                       }

-               // DO NOT change detectedPeer !!!
-               // The given physical.udp may be WRONG!!!
+                       // DO NOT change detectedPeer !!!
+                       // The given physical.udp may be WRONG!!!

-               // In future, ARKs may support automatic transition when the 
ARK key is changed.
-               // So parse it anyway. If it fails, no big loss; it won't even 
log an error.
+                       // In future, ARKs may support automatic transition 
when the ARK key is changed.
+                       // So parse it anyway. If it fails, no big loss; it 
won't even log an error.
                }

                if(logMINOR)
@@ -2115,11 +2114,11 @@
                        refHadNegTypes = true;
                }
                if(!forDiffNodeRef || refHadNegTypes) {
-               if(!Arrays.equals(negTypes, newNegTypes)) {
-                       changedAnything = true;
-                       negTypes = newNegTypes;
+                       if(!Arrays.equals(negTypes, newNegTypes)) {
+                               changedAnything = true;
+                               negTypes = newNegTypes;
+                       }
                }
-               }

                if(parseARK(fs, false))
                        changedAnything = true;
@@ -3335,11 +3334,11 @@
                return true;
        }

-    public synchronized long timeLastDisconnect() {
-       return timeLastDisconnect;
-    }
+       public synchronized long timeLastDisconnect() {
+               return timeLastDisconnect;
+       }

-    /** Does this peernode want to be returned by for example 
PeerManager.getByPeer() ? */
+       /** Does this peernode want to be returned by for example 
PeerManager.getByPeer() ? */
        public abstract boolean isSearchable();

        /** Can we accept announcements from this node? */


Reply via email to