Author: toad
Date: 2007-12-06 17:53:37 +0000 (Thu, 06 Dec 2007)
New Revision: 16368
Modified:
trunk/freenet/src/freenet/io/comm/Message.java
trunk/freenet/src/freenet/io/comm/PeerContext.java
trunk/freenet/src/freenet/node/CHKInsertSender.java
trunk/freenet/src/freenet/node/InsertHandler.java
trunk/freenet/src/freenet/node/LocationManager.java
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/NodeDispatcher.java
trunk/freenet/src/freenet/node/PeerNode.java
trunk/freenet/src/freenet/node/RequestHandler.java
trunk/freenet/src/freenet/node/SSKInsertHandler.java
Log:
Don't let old Message's keep PeerNode's in memory.
Pass explicitly PeerNode's wherever possible and check for null in a few places
that need it.
Modified: trunk/freenet/src/freenet/io/comm/Message.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/Message.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/io/comm/Message.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -20,6 +20,7 @@
package freenet.io.comm;
import java.io.*;
+import java.lang.ref.WeakReference;
import java.util.*;
import freenet.support.Fields;
@@ -36,7 +37,8 @@
public static final String VERSION = "$Id: Message.java,v 1.11 2005/09/15
18:16:04 amphibian Exp $";
private final MessageType _spec;
- private final PeerContext _source;
+ private final WeakReference/*<PeerContext>*/ _sourceRef;
+ private final boolean _internal;
private final HashMap _payload = new HashMap(8, 1.0F); // REDFLAG at
the moment memory is more of an issue than CPU so we use a high load factor
private Vector _subMessages;
public final long localInstantiationTime;
@@ -115,7 +117,8 @@
private Message(MessageType spec, PeerContext source, int
recvByteCount) {
localInstantiationTime = System.currentTimeMillis();
_spec = spec;
- _source = source;
+ _internal = source == null;
+ _sourceRef = source.getWeakRef();
_receivedByteCount = recvByteCount;
}
@@ -243,11 +246,11 @@
}
public PeerContext getSource() {
- return _source;
+ return (PeerContext) _sourceRef.get();
}
public boolean isInternal() {
- return _source == null;
+ return _internal;
}
public MessageType getSpec() {
Modified: trunk/freenet/src/freenet/io/comm/PeerContext.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/PeerContext.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/io/comm/PeerContext.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -3,6 +3,8 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.io.comm;
+import java.lang.ref.WeakReference;
+
import freenet.io.xfer.PacketThrottle;
import freenet.node.OutgoingPacketMangler;
@@ -44,4 +46,8 @@
/** Get the OutgoingPacketMangler which encrypts outgoing packets to
this node */
OutgoingPacketMangler getOutgoingMangler();
+
+ /** Get a WeakReference to this context. Hopefully there is only one of
these for the whole object; they are quite
+ * expensive. */
+ WeakReference getWeakRef();
}
Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertSender.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -739,6 +739,7 @@
if(m != null) {
// Process message
PeerNode pn = (PeerNode)
m.getSource();
+ // pn cannot be null, because
the filters will prevent garbage collection of the nodes
boolean processed = false;
for(int
i=0;i<waiters.length;i++) {
PeerNode p =
waiters[i].pn;
Modified: trunk/freenet/src/freenet/node/InsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/InsertHandler.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/InsertHandler.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -47,11 +47,11 @@
PartiallyReceivedBlock prb;
private static boolean logMINOR;
- InsertHandler(Message req, long id, Node node, long startTime) {
+ InsertHandler(Message req, PeerNode source, long id, Node node, long
startTime) {
this.req = req;
this.node = node;
this.uid = id;
- this.source = (PeerNode) req.getSource();
+ this.source = source;
this.startTime = startTime;
key = (NodeCHK) req.getObject(DMT.FREENET_ROUTING_KEY);
htl = req.getShort(DMT.HTL);
Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -756,8 +756,7 @@
* @return True if we have handled the message, false if it needs
* to be handled otherwise.
*/
- public boolean handleSwapRequest(Message m) {
- PeerNode pn = (PeerNode)m.getSource();
+ public boolean handleSwapRequest(Message m, PeerNode pn) {
long oldID = m.getLong(DMT.UID);
Long luid = new Long(oldID);
long newID = oldID+1;
@@ -879,7 +878,7 @@
* Handle an unmatched FNPSwapReply
* @return True if we recognized and forwarded this reply.
*/
- public boolean handleSwapReply(Message m) {
+ public boolean handleSwapReply(Message m, PeerNode source) {
long uid = m.getLong(DMT.UID);
Long luid = new Long(uid);
RecentlyForwardedItem item = (RecentlyForwardedItem)
recentlyForwardedIDs.get(luid);
@@ -888,22 +887,22 @@
return false;
}
if(item.requestSender == null) {
- if(logMINOR) Logger.minor(this, "SwapReply from
"+m.getSource()+" on chain originated locally "+uid);
+ if(logMINOR) Logger.minor(this, "SwapReply from "+source+" on
chain originated locally "+uid);
return false;
}
if(item.routedTo == null) {
Logger.error(this, "Got SwapReply on "+uid+" but routedTo is
null!");
return false;
}
- if(m.getSource() != item.routedTo) {
- Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+m.getSource()+
+ if(source != item.routedTo) {
+ Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+source+
" should be "+item.routedTo+" to "+item.requestSender);
return true;
}
item.lastMessageTime = System.currentTimeMillis();
// Returning to source - use incomingID
m.set(DMT.UID, item.incomingID);
- if(logMINOR) Logger.minor(this, "Forwarding SwapReply "+uid+" from
"+m.getSource()+" to "+item.requestSender);
+ if(logMINOR) Logger.minor(this, "Forwarding SwapReply "+uid+" from
"+source+" to "+item.requestSender);
try {
item.requestSender.sendAsync(m, null, 0, null);
} catch (NotConnectedException e) {
@@ -916,7 +915,7 @@
* Handle an unmatched FNPSwapRejected
* @return True if we recognized and forwarded this message.
*/
- public boolean handleSwapRejected(Message m) {
+ public boolean handleSwapRejected(Message m, PeerNode source) {
long uid = m.getLong(DMT.UID);
Long luid = new Long(uid);
RecentlyForwardedItem item = (RecentlyForwardedItem)
recentlyForwardedIDs.get(luid);
@@ -929,14 +928,14 @@
Logger.error(this, "Got SwapRejected on "+uid+" but routedTo is
null!");
return false;
}
- if(m.getSource() != item.routedTo) {
- Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+m.getSource()+
+ if(source != item.routedTo) {
+ Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+source+
" should be "+item.routedTo+" to "+item.requestSender);
return true;
}
removeRecentlyForwardedItem(item);
item.lastMessageTime = System.currentTimeMillis();
- if(logMINOR) Logger.minor(this, "Forwarding SwapRejected "+uid+" from
"+m.getSource()+" to "+item.requestSender);
+ if(logMINOR) Logger.minor(this, "Forwarding SwapRejected "+uid+" from
"+source+" to "+item.requestSender);
// Returning to source - use incomingID
m.set(DMT.UID, item.incomingID);
try {
@@ -951,19 +950,19 @@
* Handle an unmatched FNPSwapCommit
* @return True if we recognized and forwarded this message.
*/
- public boolean handleSwapCommit(Message m) {
+ public boolean handleSwapCommit(Message m, PeerNode source) {
long uid = m.getLong(DMT.UID);
Long luid = new Long(uid);
RecentlyForwardedItem item = (RecentlyForwardedItem)
recentlyForwardedIDs.get(luid);
if(item == null) return false;
if(item.routedTo == null) return false;
- if(m.getSource() != item.requestSender) {
- Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+m.getSource()+
+ if(source != item.requestSender) {
+ Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+source+
" should be "+item.requestSender+" to "+item.routedTo);
return true;
}
item.lastMessageTime = System.currentTimeMillis();
- if(logMINOR) Logger.minor(this, "Forwarding SwapCommit "+uid+ ','
+item.outgoingID+" from "+m.getSource()+" to "+item.routedTo);
+ if(logMINOR) Logger.minor(this, "Forwarding SwapCommit "+uid+ ','
+item.outgoingID+" from "+source+" to "+item.routedTo);
// Sending onwards - use outgoing ID
m.set(DMT.UID, item.outgoingID);
try {
@@ -979,7 +978,7 @@
* Handle an unmatched FNPSwapComplete
* @return True if we recognized and forwarded this message.
*/
- public boolean handleSwapComplete(Message m) {
+ public boolean handleSwapComplete(Message m, PeerNode source) {
long uid = m.getLong(DMT.UID);
if(logMINOR) Logger.minor(this, "handleSwapComplete("+uid+ ')');
Long luid = new Long(uid);
@@ -996,12 +995,12 @@
Logger.error(this, "Got SwapComplete on "+uid+" but routedTo ==
null! (meaning we accepted it, presumably)");
return false;
}
- if(m.getSource() != item.routedTo) {
- Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+m.getSource()+
+ if(source != item.routedTo) {
+ Logger.error(this, "Unmatched swapreply "+uid+" from wrong source:
From "+source+
" should be "+item.routedTo+" to "+item.requestSender);
return true;
}
- if(logMINOR) Logger.minor(this, "Forwarding SwapComplete "+uid+" from
"+m.getSource()+" to "+item.requestSender);
+ if(logMINOR) Logger.minor(this, "Forwarding SwapComplete "+uid+" from
"+source+" to "+item.requestSender);
// Returning to source - use incomingID
m.set(DMT.UID, item.incomingID);
try {
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2007-12-06 17:29:39 UTC (rev
16367)
+++ trunk/freenet/src/freenet/node/Node.java 2007-12-06 17:53:37 UTC (rev
16368)
@@ -1591,7 +1591,7 @@
Message m = DMT.createFNPRoutedPing(uid, loc2, maxHTL,
initialX);
Logger.normal(this, "Message: "+m);
- dispatcher.handleRouted(m);
+ dispatcher.handleRouted(m, null);
// FIXME: might be rejected
MessageFilter mf1 = MessageFilter.create().setField(DMT.UID,
uid).setType(DMT.FNPRoutedPong).setTimeout(5000);
try {
@@ -2405,8 +2405,7 @@
/**
* Handle a received node to node message
*/
- public void receivedNodeToNodeMessage(Message m) {
- PeerNode src = (PeerNode) m.getSource();
+ public void receivedNodeToNodeMessage(Message m, PeerNode src) {
int type = ((Integer)
m.getObject(DMT.NODE_TO_NODE_MESSAGE_TYPE)).intValue();
ShortBuffer messageData = (ShortBuffer)
m.getObject(DMT.NODE_TO_NODE_MESSAGE_DATA);
receivedNodeToNodeMessage(src, type, messageData, false);
Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -45,13 +45,17 @@
public boolean handleMessage(Message m) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
PeerNode source = (PeerNode)m.getSource();
+ if(source == null) {
+ // Node has been disconnected and garbage collected
already! Ouch.
+ return true;
+ }
if(logMINOR) Logger.minor(this, "Dispatching "+m+" from
"+source);
MessageType spec = m.getSpec();
if(spec == DMT.FNPPing) {
// Send an FNPPong
Message reply =
DMT.createFNPPong(m.getInt(DMT.PING_SEQNO));
try {
- m.getSource().sendAsync(reply, null, 0, null);
// nothing we can do if can't contact source
+ source.sendAsync(reply, null, 0, null); //
nothing we can do if can't contact source
} catch (NotConnectedException e) {
if(logMINOR) Logger.minor(this, "Lost
connection replying to "+m);
}
@@ -85,7 +89,7 @@
handleDisconnect(m, source);
return true;
} else if(spec == DMT.nodeToNodeMessage) {
- node.receivedNodeToNodeMessage(m);
+ node.receivedNodeToNodeMessage(m, source);
return true;
} else if(spec == DMT.UOMAnnounce) {
return node.nodeUpdater.uom.handleAnnounce(m, source);
@@ -117,15 +121,15 @@
source.updateLocation(newLoc);
return true;
} else if(spec == DMT.FNPSwapRequest) {
- return node.lm.handleSwapRequest(m);
+ return node.lm.handleSwapRequest(m, source);
} else if(spec == DMT.FNPSwapReply) {
- return node.lm.handleSwapReply(m);
+ return node.lm.handleSwapReply(m, source);
} else if(spec == DMT.FNPSwapRejected) {
- return node.lm.handleSwapRejected(m);
+ return node.lm.handleSwapRejected(m, source);
} else if(spec == DMT.FNPSwapCommit) {
- return node.lm.handleSwapCommit(m);
+ return node.lm.handleSwapCommit(m, source);
} else if(spec == DMT.FNPSwapComplete) {
- return node.lm.handleSwapComplete(m);
+ return node.lm.handleSwapComplete(m, source);
} else if(spec == DMT.FNPCHKDataRequest) {
return handleDataRequest(m, source, false);
} else if(spec == DMT.FNPSSKDataRequest) {
@@ -135,7 +139,7 @@
} else if(spec == DMT.FNPSSKInsertRequest) {
return handleInsertRequest(m, source, true);
} else if(spec == DMT.FNPRoutedPing) {
- return handleRouted(m);
+ return handleRouted(m, source);
} else if(spec == DMT.FNPRoutedPong) {
return handleRoutedReply(m);
} else if(spec == DMT.FNPRoutedRejected) {
@@ -193,7 +197,7 @@
if(node.recentlyCompleted(id)) {
Message rejected = DMT.createFNPRejectedLoop(id);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
Logger.normal(this, "Rejecting data request
(loop, finished): "+e);
}
@@ -203,9 +207,9 @@
if(logMINOR) Logger.minor(this, "Could not lock ID
"+id+" -> rejecting (already running)");
Message rejected = DMT.createFNPRejectedLoop(id);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
- Logger.normal(this, "Rejecting insert request
from "+m.getSource().getPeer()+": "+e);
+ Logger.normal(this, "Rejecting insert request
from "+source.getPeer()+": "+e);
}
return true;
} else {
@@ -214,18 +218,18 @@
String rejectReason = nodeStats.shouldRejectRequest(!isSSK,
false, isSSK, false, source);
if(rejectReason != null) {
// can accept 1 CHK request every so often, but not
with SSKs because they aren't throttled so won't sort out bwlimitDelayTime,
which was the whole reason for accepting them when overloaded...
- Logger.normal(this, "Rejecting request from
"+m.getSource().getPeer()+" preemptively because "+rejectReason);
+ Logger.normal(this, "Rejecting request from
"+source.getPeer()+" preemptively because "+rejectReason);
Message rejected = DMT.createFNPRejectedOverload(id,
true);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
- Logger.normal(this, "Rejecting (overload) data
request from "+m.getSource().getPeer()+": "+e);
+ Logger.normal(this, "Rejecting (overload) data
request from "+source.getPeer()+": "+e);
}
node.unlockUID(id, isSSK, false, false);
return true;
}
//if(!node.lockUID(id)) return false;
- RequestHandler rh = new RequestHandler(m, id, node);
+ RequestHandler rh = new RequestHandler(m, source, id, node);
node.executor.execute(rh, "RequestHandler for UID "+id);
return true;
}
@@ -235,9 +239,9 @@
if(node.recentlyCompleted(id)) {
Message rejected = DMT.createFNPRejectedLoop(id);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
- Logger.normal(this, "Rejecting insert request
from "+m.getSource().getPeer()+": "+e);
+ Logger.normal(this, "Rejecting insert request
from "+source.getPeer()+": "+e);
}
return true;
}
@@ -245,31 +249,31 @@
if(logMINOR) Logger.minor(this, "Could not lock ID
"+id+" -> rejecting (already running)");
Message rejected = DMT.createFNPRejectedLoop(id);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
- Logger.normal(this, "Rejecting insert request
from "+m.getSource().getPeer()+": "+e);
+ Logger.normal(this, "Rejecting insert request
from "+source.getPeer()+": "+e);
}
return true;
}
// SSKs don't fix bwlimitDelayTime so shouldn't be accepted
when overloaded.
String rejectReason = nodeStats.shouldRejectRequest(!isSSK,
true, isSSK, false, source);
if(rejectReason != null) {
- Logger.normal(this, "Rejecting insert from
"+m.getSource().getPeer()+" preemptively because "+rejectReason);
+ Logger.normal(this, "Rejecting insert from
"+source.getPeer()+" preemptively because "+rejectReason);
Message rejected = DMT.createFNPRejectedOverload(id,
true);
try {
- m.getSource().sendAsync(rejected, null, 0,
null);
+ source.sendAsync(rejected, null, 0, null);
} catch (NotConnectedException e) {
- Logger.normal(this, "Rejecting (overload)
insert request from "+m.getSource().getPeer()+": "+e);
+ Logger.normal(this, "Rejecting (overload)
insert request from "+source.getPeer()+": "+e);
}
node.unlockUID(id, isSSK, true, false);
return true;
}
long now = System.currentTimeMillis();
if(m.getSpec().equals(DMT.FNPSSKInsertRequest)) {
- SSKInsertHandler rh = new SSKInsertHandler(m, id, node,
now);
+ SSKInsertHandler rh = new SSKInsertHandler(m, source,
id, node, now);
node.executor.execute(rh, "InsertHandler for "+id+" on
"+node.getDarknetPortNumber());
} else {
- InsertHandler rh = new InsertHandler(m, id, node, now);
+ InsertHandler rh = new InsertHandler(m, source, id,
node, now);
node.executor.execute(rh, "InsertHandler for "+id+" on
"+node.getDarknetPortNumber());
}
if(logMINOR) Logger.minor(this, "Started InsertHandler for
"+id);
@@ -332,9 +336,9 @@
Message msg;
short lastHtl;
- RoutedContext(Message msg) {
+ RoutedContext(Message msg, PeerNode source) {
createdTime = accessTime = System.currentTimeMillis();
- source = (PeerNode)msg.getSource();
+ this.source = source;
routedTo = new HashSet();
notIgnored = new HashSet();
this.msg = msg;
@@ -373,48 +377,47 @@
* @param m
* @return False if we want the message put back on the queue.
*/
- boolean handleRouted(Message m) {
+ boolean handleRouted(Message m, PeerNode source) {
if(logMINOR) Logger.minor(this, "handleRouted("+m+ ')');
- if((m.getSource() != null) && (!(m.getSource() instanceof
PeerNode))) {
- Logger.error(this, "Routed message but source
"+m.getSource()+" not a PeerNode!");
+ if((source != null) && (!(source instanceof PeerNode))) {
+ Logger.error(this, "Routed message but source
"+source+" not a PeerNode!");
return true;
}
long id = m.getLong(DMT.UID);
Long lid = new Long(id);
- PeerNode pn = (PeerNode) (m.getSource());
short htl = m.getShort(DMT.HTL);
- if(pn != null) htl = pn.decrementHTL(htl);
+ if(source != null) htl = source.decrementHTL(htl);
RoutedContext ctx;
ctx = (RoutedContext)routedContexts.get(lid);
if(ctx != null) {
try {
-
m.getSource().sendAsync(DMT.createFNPRoutedRejected(id, (short)(htl-1)), null,
0, null);
+
source.sendAsync(DMT.createFNPRoutedRejected(id, (short)(htl-1)), null, 0,
null);
} catch (NotConnectedException e) {
if(logMINOR) Logger.minor(this, "Lost
connection rejecting "+m);
}
return true;
}
- ctx = new RoutedContext(m);
+ ctx = new RoutedContext(m, source);
routedContexts.put(lid, ctx);
// pn == null => originated locally, keep full htl
double target = m.getDouble(DMT.TARGET_LOCATION);
- if(logMINOR) Logger.minor(this, "id "+id+" from "+pn+" htl
"+htl+" target "+target);
+ if(logMINOR) Logger.minor(this, "id "+id+" from "+source+" htl
"+htl+" target "+target);
if(Math.abs(node.lm.getLocation() - target) <=
Double.MIN_VALUE) {
if(logMINOR) Logger.minor(this, "Dispatching
"+m.getSpec()+" on "+node.getDarknetPortNumber());
// Handle locally
// Message type specific processing
- dispatchRoutedMessage(m, pn, id);
+ dispatchRoutedMessage(m, source, id);
return true;
} else if(htl == 0) {
Message reject = DMT.createFNPRoutedRejected(id,
(short)0);
- if(pn != null) try {
- pn.sendAsync(reject, null, 0, null);
+ if(source != null) try {
+ source.sendAsync(reject, null, 0, null);
} catch (NotConnectedException e) {
if(logMINOR) Logger.minor(this, "Lost
connection rejecting "+m);
}
return true;
} else {
- return forward(m, id, pn, htl, target, ctx);
+ return forward(m, id, source, htl, target, ctx);
}
}
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -3199,4 +3199,8 @@
return -1;
}
+ public WeakReference getWeakRef() {
+ return myRef;
+ }
+
}
Modified: trunk/freenet/src/freenet/node/RequestHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestHandler.java 2007-12-06 17:29:39 UTC
(rev 16367)
+++ trunk/freenet/src/freenet/node/RequestHandler.java 2007-12-06 17:53:37 UTC
(rev 16368)
@@ -47,12 +47,12 @@
return super.toString()+" for "+uid;
}
- public RequestHandler(Message m, long id, Node n) {
+ public RequestHandler(Message m, PeerNode source, long id, Node n) {
req = m;
node = n;
uid = id;
htl = req.getShort(DMT.HTL);
- source = (PeerNode) req.getSource();
+ this.source = source;
closestLoc = req.getDouble(DMT.NEAREST_LOCATION);
double myLoc = n.lm.getLocation();
key = (Key) req.getObject(DMT.FREENET_ROUTING_KEY);
Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java 2007-12-06
17:29:39 UTC (rev 16367)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java 2007-12-06
17:53:37 UTC (rev 16368)
@@ -45,11 +45,11 @@
private byte[] headers;
private boolean canCommit;
- SSKInsertHandler(Message req, long id, Node node, long startTime) {
+ SSKInsertHandler(Message req, PeerNode source, long id, Node node, long
startTime) {
this.req = req;
this.node = node;
this.uid = id;
- this.source = (PeerNode) req.getSource();
+ this.source = source;
this.startTime = startTime;
key = (NodeSSK) req.getObject(DMT.FREENET_ROUTING_KEY);
htl = req.getShort(DMT.HTL);