Author: nextgens
Date: 2006-07-10 12:05:34 +0000 (Mon, 10 Jul 2006)
New Revision: 9543

Modified:
   trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
   trunk/freenet/src/freenet/io/comm/MessageFilter.java
   trunk/freenet/src/freenet/io/comm/Peer.java
   trunk/freenet/src/freenet/io/comm/RetrievalException.java
   trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
   trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
   trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
   trunk/freenet/src/freenet/io/xfer/PartiallyReceivedBlock.java
   trunk/freenet/src/freenet/node/updater/UpdateRevocationURICallback.java
   trunk/freenet/src/freenet/node/updater/UpdateURICallback.java
Log:
more work on locking...

Modified: trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-07-10 
12:05:34 UTC (rev 9543)
@@ -8,12 +8,12 @@
        public static final int STATISTICS_ENTRIES = 10;
        public static final int STATISTICS_DURATION_S = 30;
        public static final int STATISTICS_DURATION = 
1000*STATISTICS_DURATION_S;
-       private long lastrotate=0;
+       private long lastrotate;

-       private static IOStatisticCollector _currentSC = null;
-       private long totalbytesin = 0;
-       private long totalbytesout = 0;
-       private HashMap targets = null;
+       private static IOStatisticCollector _currentSC;
+       private long totalbytesin;
+       private long totalbytesout;
+       private HashMap targets;

        private IOStatisticCollector() {
                // Only I should be able to create myself

Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java        2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java        2006-07-10 
12:05:34 UTC (rev 9543)
@@ -34,14 +34,14 @@
     public static final String VERSION = "$Id: MessageFilter.java,v 1.7 
2005/08/25 17:28:19 amphibian Exp $";

     private static final int DEFAULT_TIMEOUT = 10000;
-    private boolean _matched = false;
+    private boolean _matched;
     private PeerContext _droppedConnection;
        private MessageType _type;
     private HashMap _fields = new HashMap();
     PeerContext _source;
     private long _timeout;
     private int _initialTimeout;
-    private MessageFilter _or = null;
+    private MessageFilter _or;
     private Message _message;
     private boolean _matchesDroppedConnections;


Modified: trunk/freenet/src/freenet/io/comm/Peer.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/Peer.java 2006-07-10 10:35:59 UTC (rev 
9542)
+++ trunk/freenet/src/freenet/io/comm/Peer.java 2006-07-10 12:05:34 UTC (rev 
9543)
@@ -33,7 +33,7 @@
  */
 public class Peer implements WritableToDataOutputStream {

-    public class LocalAddressException extends Exception {
+    public static class LocalAddressException extends Exception {
        private static final long serialVersionUID = -1;
        }


Modified: trunk/freenet/src/freenet/io/comm/RetrievalException.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/RetrievalException.java   2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/comm/RetrievalException.java   2006-07-10 
12:05:34 UTC (rev 9543)
@@ -41,7 +41,7 @@
     public static final int NO_DATAINSERT = 8;

        int _reason;
-       String _cause = null;
+       String _cause;

        public RetrievalException(int reason) {
                _reason = reason;

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2006-07-10 
12:05:34 UTC (rev 9543)
@@ -38,15 +38,15 @@
        /** _filters serves as lock for both */
        private LinkedList _filters = new LinkedList();
        private LinkedList _unclaimed = new LinkedList();
-       private int _unclaimedPos = 0;
-       private int _dropProbability = 0;
+       private int _unclaimedPos;
+       private int _dropProbability;
        private LowLevelFilter lowLevelFilter;
        /** RNG for debugging, used with _dropProbability.
         * NOT CRYPTO SAFE. DO NOT USE FOR THINGS THAT NEED CRYPTO SAFE RNG!
         */
        private Random dropRandom;
-       private boolean _active = true;
-       private boolean _isDone = false;
+       private boolean _active;
+       private boolean _isDone;
        private static UdpSocketManager _usm;
        private static final int MAX_UNMATCHED_FIFO_SIZE = 50000;
        private volatile int lastTimeInSeconds;

Modified: trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java     2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java     2006-07-10 
12:05:34 UTC (rev 9543)
@@ -46,13 +46,13 @@

        UdpSocketManager _usm;
        PeerContext _destination;
-       boolean _sendComplete = false;
+       boolean _sendComplete;
        long _uid;
        PartiallyReceivedBlock _prb;
        LinkedList _unsent;
        Thread _receiverThread, _senderThread;
        BitArray _sentPackets;
-       boolean failedByOverload = false;
+       boolean failedByOverload;
        final PacketThrottle throttle;
        long timeAllSent = -1;
        final DoubleTokenBucket _masterThrottle;

Modified: trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/PacketThrottle.java       2006-07-10 
10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/xfer/PacketThrottle.java       2006-07-10 
12:05:34 UTC (rev 9543)
@@ -34,7 +34,7 @@
        public static final long DEFAULT_DELAY = 200;
        private static Map _throttles = new HashMap();
        private final Peer _peer;
-       private long _roundTripTime = 500, _totalPackets = 0, _droppedPackets = 
0;
+       private long _roundTripTime = 500, _totalPackets, _droppedPackets;
        private float _simulatedWindowSize = 2;
        private final int PACKET_SIZE;

@@ -88,7 +88,7 @@
                return Math.max(MIN_DELAY, (long) (_roundTripTime / 
_simulatedWindowSize));
        }

-       public String toString() {
+       public synchronized String toString() {
                return Double.toString((((PACKET_SIZE * 1000.0 / getDelay())) / 
1024)) + " k/sec, (w: "
                                + _simulatedWindowSize + ", r:" + 
_roundTripTime + ", d:"
                                + (((float) _droppedPackets / (float) 
_totalPackets)) + ") for "+_peer;

Modified: trunk/freenet/src/freenet/io/xfer/PartiallyReceivedBlock.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/PartiallyReceivedBlock.java       
2006-07-10 10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/io/xfer/PartiallyReceivedBlock.java       
2006-07-10 12:05:34 UTC (rev 9543)
@@ -33,9 +33,9 @@

        byte[] _data;
        boolean[] _received;
-       int _receivedCount = 0;
+       int _receivedCount;
        int _packets, _packetSize;
-       boolean _aborted = false;
+       boolean _aborted;
        int _abortReason;
        String _abortDescription;
        LinkedList _packetReceivedListeners = new LinkedList();
@@ -124,14 +124,14 @@
                }
        }

-       public boolean allReceived() throws AbortedException {
+       public synchronized boolean allReceived() throws AbortedException {
                if (_aborted) {
                        throw new AbortedException("PRB is aborted");
                }
                return _receivedCount == _packets;
        }

-       public byte[] getBlock() throws AbortedException {
+       public synchronized byte[] getBlock() throws AbortedException {
                if (_aborted) {
                        throw new AbortedException("PRB is aborted");
                }
@@ -141,7 +141,7 @@
                return _data;
        }

-       public Buffer getPacket(int x) throws AbortedException {
+       public synchronized Buffer getPacket(int x) throws AbortedException {
                if (_aborted) {
                        throw new AbortedException("PRB is aborted");
                }

Modified: 
trunk/freenet/src/freenet/node/updater/UpdateRevocationURICallback.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/UpdateRevocationURICallback.java     
2006-07-10 10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/node/updater/UpdateRevocationURICallback.java     
2006-07-10 12:05:34 UTC (rev 9543)
@@ -22,7 +22,7 @@
        }

        public void set(String val) {
-               if(val.equals(get())) return;
+               if(val!=null && val.equals(get())) return;
                // Good idea to prevent it ? 
                //
                // Maybe it NEEDS to be implemented

Modified: trunk/freenet/src/freenet/node/updater/UpdateURICallback.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/UpdateURICallback.java       
2006-07-10 10:35:59 UTC (rev 9542)
+++ trunk/freenet/src/freenet/node/updater/UpdateURICallback.java       
2006-07-10 12:05:34 UTC (rev 9543)
@@ -23,7 +23,7 @@
        }

        public void set(String val) {
-               if(val.equals(get())) return;
+               if(val!=null && val.equals(get())) return;
                // Good idea to prevent it ? 
                //
                // Maybe it NEEDS to be implemented


Reply via email to