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

Modified Files:
        ConnectionHandler.java 
Log Message:
6283:
Set new threads to NORMAL priority level. Hopefully this won't fsck up people's 
efforts to nice freenet... it seems to be necessary under some platforms because the 
ticker is at max priority and they inherit by default.
Don't close the selector if it's already closed in ASL.reset(), catch any throwables 
caught by closing and try to reopen anyway. Documet mySelect. Catch 
ClosedSelectorException and try to handle it in mySelect.
Fix NPE in ConnectionHandler.
Logging.


Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -w -r1.200 -r1.201
--- ConnectionHandler.java      27 Oct 2003 14:45:17 -0000      1.200
+++ ConnectionHandler.java      28 Oct 2003 03:02:50 -0000      1.201
@@ -2099,11 +2099,16 @@
        protected boolean innerSendPacket(int prio) {
                lastActiveTime = System.currentTimeMillis();
                PeerPacket sp = sentPacket;
+               if(sp == null) {
+                       if(finalized.state()) return; // race with terminate
+                       Core.logger.log(this, "innerSendPacket() called but sentPacket 
is NULL!",
+                                                       new Exception("debug"), 
Logger.ERROR);
+               }
                byte[] toSend = sp.getBytes();
                // extra paranoia
                if(trailerSendID != -1) {
                        if(logDEBUG) 
-                               logDEBUG("innerSendPacket("+prio+","+sentPacket+
+                               logDEBUG("innerSendPacket("+prio+","+sp+
                                                 " called but sending a trailer!");
                        return false;
                }
@@ -2113,7 +2118,7 @@
                        sendBytes(toSend, 0, toSend.length, prio);
                } catch (IOException e) {
                        Core.logger.log(this, "Got IOException trying to send packet "+
-                                                       sentPacket+": "+e, 
Logger.MINOR);
+                                                       sp+": "+e, Logger.MINOR);
                        synchronized(sendLock) {
                                sendClosed.change(true);
                                sendLock.notifyAll();
@@ -2123,7 +2128,7 @@
                        return false;
                } catch (Throwable t) {
                        Core.logger.log(this, "Caught "+t+ " trying to send packet "+
-                                                       sentPacket, t, Logger.ERROR);
+                                                       sp, t, Logger.ERROR);
                        synchronized(sendLock) {
                                sendClosed.change(true);
                                sendLock.notifyAll();

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

Reply via email to