Author: robert
Date: 2008-01-12 01:04:42 +0000 (Sat, 12 Jan 2008)
New Revision: 17026
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
optimize
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-12 00:06:18 UTC
(rev 17025)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-12 01:04:42 UTC
(rev 17026)
@@ -984,7 +984,7 @@
private void enqueuePrioritizedMessageItem(MessageItem addMe) {
synchronized (messagesToSendNow) {
- //Assume it goes on the end, both the common case and
an accelerator for requeueing.
+ //Assume it goes on the end, both the common case
ListIterator
i=messagesToSendNow.listIterator(messagesToSendNow.size());
while (i.hasPrevious()) {
MessageItem here=(MessageItem)i.previous();
@@ -1003,13 +1003,13 @@
*/
private void pushfrontPrioritizedMessageItem(MessageItem addMe) {
synchronized (messagesToSendNow) {
- //Assume it goes on the end, both the common case and
an accelerator for requeueing.
- ListIterator
i=messagesToSendNow.listIterator(messagesToSendNow.size());
- while (i.hasPrevious()) {
- MessageItem here=(MessageItem)i.previous();
- //While the item we are adding is NOT-LESS-THAN
priority, move on (backwards...)
- if (!(addMe.getPriority() <=
here.getPriority())) {
- i.next();
+ //Assume it goes on the front
+ ListIterator i=messagesToSendNow.listIterator();
+ while (i.hasNext()) {
+ MessageItem here=(MessageItem)i.next();
+ //While the item we are adding is a LOWER
priority, move on (forwards...)
+ if (addMe.getPriority() <= here.getPriority()) {
+ i.previous();
break;
}
}