Update of /cvsroot/freenet/freenet/src/freenet/diagnostics
In directory sc8-pr-cvs1:/tmp/cvs-serv29253/src/freenet/diagnostics

Modified Files:
        FileEventList.java 
Log Message:
6234:
* Limit the volume of queryrejects sent to a node due to version being too old. 
Includes exponential backoff.
* Dump low priority messages (e.g. most QueryRejected's) if we don't have a free conn 
(reinstates pre-PH behaviour - bugfix).
* If a node is not contactable, and no free connections, discard the message.
* Bugfixes in PacketMessage.jobDone relating to losing message sent notifications.
* New diagnostics: messageSendTimeContactable, messageSendTimeNonContactable. Not all 
old ones restored yet.
* Make sure we close files in FileEventList
* Add count of total files open by NativeFSDir to interesting objects dump.
* Indenting, logging


Index: FileEventList.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/FileEventList.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileEventList.java  14 Dec 2002 18:15:07 -0000      1.3
+++ FileEventList.java  11 Oct 2003 20:00:17 -0000      1.4
@@ -92,49 +92,59 @@
     }
 
     private boolean write(DoublyLinkedList ll, File f) {
+       DataOutputStream out = null;
         try {
-            DataOutputStream out = new 
+            out = new 
                 DataOutputStream(new 
-                    BufferedOutputStream(new 
-                        FileOutputStream(f)));
-
+                                BufferedOutputStream(new 
+                                                     FileOutputStream(f)));
+           
             for (Enumeration e = ll.elements() ; e.hasMoreElements() ;) {
                 ((VarEvent) e.nextElement()).write(out);
                 out.writeBoolean(e.hasMoreElements());
             }
             out.flush();
-            out.close();
             return true;
         } catch (IOException e) {
             Core.logger.log(this, 
                             "Failed to write data to disk, not overwriting", 
                             e, Core.logger.ERROR);
             return false;
-        }
+        } finally {
+           if(out != null) {
+               try {
+                   out.close();
+               } catch (Throwable t) {};
+           }
+       }
     }
-
+    
     private DoublyLinkedList read(File f, RandomVar to) {
+       DataInputStream in = null;
         try {
-            DataInputStream in = new
+            in = new
                 DataInputStream(new 
-                    BufferedInputStream(new
-                        FileInputStream(f)));
+                               BufferedInputStream(new
+                                                   FileInputStream(f)));
             boolean more;
             DoublyLinkedList ll = new DoublyLinkedListImpl();
             do {
                 ll.push(to.readEvent(in));
             } while (in.readBoolean());
-
-            in.close();
+           
             return ll;
         } catch (IOException e) {
             Core.logger.log(this, 
                             "Failed to read data from disk, using empty file.",
                             e, Core.logger.ERROR);
             return new DoublyLinkedListImpl();
-                
-        }
-
+        } finally {
+           if(in != null) {
+               try {
+                   in.close();
+               } catch (Throwable t) {};
+           }
+       }
     }
 }
 

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to