Author: zothar
Date: 2006-11-26 02:24:18 +0000 (Sun, 26 Nov 2006)
New Revision: 11052

Modified:
   trunk/freenet/src/freenet/io/comm/DMT.java
   trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
More fixes to the 1st phase of N2NM.  Clarify the WouldBlockException rate 
limited logg message.  Timing messages in checkFilters() and waitFor().

Modified: trunk/freenet/src/freenet/io/comm/DMT.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/DMT.java  2006-11-26 01:42:28 UTC (rev 
11051)
+++ trunk/freenet/src/freenet/io/comm/DMT.java  2006-11-26 02:24:18 UTC (rev 
11052)
@@ -360,10 +360,10 @@
                addField(NODE_TO_NODE_MESSAGE_DATA, ShortBuffer.class);
        }};

-       public static final Message createNodeToNodeMessage(int type, String 
data) {
-               Message msg = new Message(nodeToNodeTextMessage);
+       public static final Message createNodeToNodeMessage(int type, byte[] 
data) {
+               Message msg = new Message(nodeToNodeMessage);
                msg.set(NODE_TO_NODE_MESSAGE_TYPE, type);
-               msg.set(NODE_TO_NODE_MESSAGE_DATA, data);
+               msg.set(NODE_TO_NODE_MESSAGE_DATA, new ShortBuffer(data));
                return msg;
        }


Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2006-11-26 
01:42:28 UTC (rev 11051)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java     2006-11-26 
02:24:18 UTC (rev 11052)
@@ -320,6 +320,7 @@
         * @param m The Message to dispatch.
         */
        public void checkFilters(Message m) {
+               long tStart = System.currentTimeMillis();
                if(logMINOR) Logger.minor(this, "checkFilters: "+m+" from 
"+m.getSource());
                if ((m.getSource()) instanceof PeerNode)
                {
@@ -413,6 +414,13 @@
                                }
                        }
                }
+               long tEnd = System.currentTimeMillis();
+               if(tEnd - tStart > 50) {
+                       if(tEnd - tStart > 500)
+                               Logger.error(this, "checkFilters took 
"+(tEnd-tStart)+"ms with unclaimedFIFOSize of "+_unclaimed.size()+" for 
matched: "+matched);
+                       else
+                               Logger.normal(this, "checkFilters took 
"+(tEnd-tStart)+"ms with unclaimedFIFOSize of "+_unclaimed.size()+" for 
matched: "+matched);
+               }
        }

        /** LowLevelFilter should call this when a node is disconnected. */
@@ -447,6 +455,7 @@
                long now = System.currentTimeMillis();
                long messageDropTime = now - MAX_UNCLAIMED_FIFO_ITEM_LIFETIME;
                long messageLifeTime = 0;
+               long tStart = System.currentTimeMillis();
                synchronized (_filters) {
                        if(logMINOR) Logger.minor(this, "Checking _unclaimed");
                        for (ListIterator i = _unclaimed.listIterator(); 
i.hasNext();) {
@@ -486,6 +495,13 @@
                                }
                        }
                }
+               long tEnd = System.currentTimeMillis();
+               if(tEnd - tStart > 50) {
+                       if(tEnd - tStart > 500)
+                               Logger.error(this, "waitFor _unclaimed 
iteration took "+(tEnd-tStart)+"ms with unclaimedFIFOSize of 
"+_unclaimed.size()+" for ret of "+ret);
+                       else
+                               Logger.normal(this, "waitFor _unclaimed 
iteration took "+(tEnd-tStart)+"ms with unclaimedFIFOSize of 
"+_unclaimed.size()+" for ret of "+ret);
+               }
                // Unlock to wait on filter
                // Waiting on the filter won't release the outer lock
                // So we have to release it here

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2006-11-26 01:42:28 UTC 
(rev 11051)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2006-11-26 02:24:18 UTC 
(rev 11052)
@@ -1008,7 +1008,7 @@
             String rateLimitWrapper = "";
             boolean rateLimitLogging = false;
             if( messages.length > messageRequeueLogRateLimitThreshold ) {
-              rateLimitWrapper = " (rate limited)";
+              rateLimitWrapper = " (log message rate limited)";
               if(nextMessageRequeueLogTime <= now ) {
                 nextMessageRequeueLogTime = now + 
messageRequeueLogRateLimitInterval;
               } else {


Reply via email to