Author: toad
Date: 2005-12-01 19:59:35 +0000 (Thu, 01 Dec 2005)
New Revision: 7649

Modified:
   trunk/freenet/src/freenet/io/comm/MessageFilter.java
   trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
   trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
   trunk/freenet/src/freenet/node/Version.java
Log:
260: (mandatory)
Fix bug in block transmitter.
Sends will no longer randomly timeout!
This was caused by a misunderstanding of MessageFilter.or(), try to avoid this.

Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java        2005-12-01 
18:52:43 UTC (rev 7648)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java        2005-12-01 
19:59:35 UTC (rev 7649)
@@ -108,6 +108,10 @@
        }

        public MessageFilter or(MessageFilter or) {
+               if(or != null && _or != null) {
+                       // FIXME maybe throw? this is almost certainly a bug, 
and a nasty one too!
+                       Logger.error(this, "or() replacement: "+_or+" -> "+or, 
new Exception("error"));
+               }
                _or = or;
                return this;
        }

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2005-12-01 
18:52:43 UTC (rev 7648)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2005-12-01 
19:59:35 UTC (rev 7649)
@@ -278,8 +278,8 @@
                                        Logger.normal(this, "Dropping 
unclaimed: "+removed);
                                    }
                                    _unclaimed.addLast(m);
+                                       Logger.minor(this, "Done");
                                }
-                               Logger.minor(this, "Done");
                        }
                }
        }

Modified: trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java     2005-12-01 
18:52:43 UTC (rev 7648)
+++ trunk/freenet/src/freenet/io/xfer/BlockTransmitter.java     2005-12-01 
19:59:35 UTC (rev 7649)
@@ -290,11 +290,10 @@
                        }
                        Message msg;
                        try {
-                               MessageFilter mf = 
-                                       
MessageFilter.create().setType(DMT.missingPacketNotification).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination).
-                                       
or(MessageFilter.create().setType(DMT.allReceived).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination)).
-                                       
or(MessageFilter.create().setType(DMT.sendAborted).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination));
-                msg = _usm.waitFor(mf);
+                               MessageFilter mfMissingPacketNotification = 
MessageFilter.create().setType(DMT.missingPacketNotification).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination);
+                               MessageFilter mfAllReceived = 
MessageFilter.create().setType(DMT.allReceived).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination);
+                               MessageFilter mfSendAborted = 
MessageFilter.create().setType(DMT.sendAborted).setField(DMT.UID, 
_uid).setTimeout(SEND_TIMEOUT).setSource(_destination);
+                msg = 
_usm.waitFor(mfMissingPacketNotification.or(mfAllReceived.or(mfSendAborted)));
             } catch (DisconnectedException e) {
                // Ignore, see below
                msg = null;

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-12-01 18:52:43 UTC (rev 
7648)
+++ trunk/freenet/src/freenet/node/Version.java 2005-12-01 19:59:35 UTC (rev 
7649)
@@ -20,10 +20,10 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 259;
+       public static final int buildNumber = 260;

        /** Oldest build of Fred we will talk to */
-       public static final int lastGoodBuild = 259;
+       public static final int lastGoodBuild = 260;

        /** The highest reported build of fred */
        public static int highestSeenBuild = buildNumber;


Reply via email to