2005-01-25 smeghead
* Tweaked some classes to enable gcj 3.4.3 to compile the router and supporting apps (except for the routerconsole which is still being investigated).
This commit is contained in:
@ -32,7 +32,7 @@ class I2PSocketImpl implements I2PSocket {
|
||||
private Object remoteIDWaiter = new Object();
|
||||
private I2PInputStream in;
|
||||
private I2POutputStream out;
|
||||
private SocketErrorListener _socketErrorListener;
|
||||
private I2PSocket.SocketErrorListener _socketErrorListener;
|
||||
private boolean outgoing;
|
||||
private long _socketId;
|
||||
private static long __socketId = 0;
|
||||
@ -284,7 +284,7 @@ class I2PSocketImpl implements I2PSocket {
|
||||
in.setReadTimeout(ms);
|
||||
}
|
||||
|
||||
public void setSocketErrorListener(SocketErrorListener lsnr) {
|
||||
public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr) {
|
||||
_socketErrorListener = lsnr;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
_listeners.clear();
|
||||
}
|
||||
for (int i = 0; i < listeners.size(); i++) {
|
||||
DisconnectListener lsnr = (DisconnectListener)listeners.get(i);
|
||||
I2PSocketManager.DisconnectListener lsnr = (I2PSocketManager.DisconnectListener)listeners.get(i);
|
||||
lsnr.sessionDisconnected();
|
||||
}
|
||||
}
|
||||
@ -720,12 +720,12 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
|
||||
public String getName() { return _name; }
|
||||
public void setName(String name) { _name = name; }
|
||||
|
||||
public void addDisconnectListener(DisconnectListener lsnr) {
|
||||
public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr) {
|
||||
synchronized (_listeners) {
|
||||
_listeners.add(lsnr);
|
||||
}
|
||||
}
|
||||
public void removeDisconnectListener(DisconnectListener lsnr) {
|
||||
public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr) {
|
||||
synchronized (_listeners) {
|
||||
_listeners.remove(lsnr);
|
||||
}
|
||||
|
@ -235,10 +235,10 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
public void setName(String name) { _name = name; }
|
||||
|
||||
|
||||
public void addDisconnectListener(DisconnectListener lsnr) {
|
||||
public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr) {
|
||||
_connectionManager.getMessageHandler().addDisconnectListener(lsnr);
|
||||
}
|
||||
public void removeDisconnectListener(DisconnectListener lsnr) {
|
||||
public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr) {
|
||||
_connectionManager.getMessageHandler().removeDisconnectListener(lsnr);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
$Id: history.txt,v 1.132 2005/01/23 03:22:11 jrandom Exp $
|
||||
$Id: history.txt,v 1.133 2005/01/24 17:42:05 smeghead Exp $
|
||||
|
||||
2005-01-25 smeghead
|
||||
* Tweaked some classes to enable gcj 3.4.3 to compile the router and
|
||||
supporting apps (except for the routerconsole which is still being
|
||||
investigated).
|
||||
|
||||
2005-01-24 smeghead
|
||||
* C#-ification of sam-sharp: interface greatly simplified using delegates
|
||||
|
@ -42,21 +42,21 @@ public class ClientManager {
|
||||
private ClientListenerRunner _listener;
|
||||
private HashMap _runners; // Destination --> ClientConnectionRunner
|
||||
private Set _pendingRunners; // ClientConnectionRunner for clients w/out a Dest yet
|
||||
private RouterContext _context;
|
||||
private RouterContext _ctx;
|
||||
|
||||
/** ms to wait before rechecking for inbound messages to deliver to clients */
|
||||
private final static int INBOUND_POLL_INTERVAL = 300;
|
||||
|
||||
public ClientManager(RouterContext context, int port) {
|
||||
_context = context;
|
||||
_ctx = context;
|
||||
_log = context.logManager().getLog(ClientManager.class);
|
||||
_context.statManager().createRateStat("client.receiveMessageSize",
|
||||
_ctx.statManager().createRateStat("client.receiveMessageSize",
|
||||
"How large are messages received by the client?",
|
||||
"ClientMessages",
|
||||
new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
_runners = new HashMap();
|
||||
_pendingRunners = new HashSet();
|
||||
_listener = new ClientListenerRunner(_context, this, port);
|
||||
_listener = new ClientListenerRunner(_ctx, this, port);
|
||||
Thread t = new I2PThread(_listener);
|
||||
t.setName("ClientListener:" + port);
|
||||
t.setDaemon(true);
|
||||
@ -70,7 +70,7 @@ public class ClientManager {
|
||||
try { Thread.sleep(2*1000); } catch (InterruptedException ie) {}
|
||||
|
||||
int port = ClientManagerFacadeImpl.DEFAULT_PORT;
|
||||
String portStr = _context.router().getConfigSetting(ClientManagerFacadeImpl.PROP_CLIENT_PORT);
|
||||
String portStr = _ctx.router().getConfigSetting(ClientManagerFacadeImpl.PROP_CLIENT_PORT);
|
||||
if (portStr != null) {
|
||||
try {
|
||||
port = Integer.parseInt(portStr);
|
||||
@ -78,7 +78,7 @@ public class ClientManager {
|
||||
_log.error("Error setting the port: " + portStr + " is not valid", nfe);
|
||||
}
|
||||
}
|
||||
_listener = new ClientListenerRunner(_context, this, port);
|
||||
_listener = new ClientListenerRunner(_ctx, this, port);
|
||||
Thread t = new I2PThread(_listener);
|
||||
t.setName("ClientListener:" + port);
|
||||
t.setDaemon(true);
|
||||
@ -150,7 +150,7 @@ public class ClientManager {
|
||||
// sender went away
|
||||
return;
|
||||
}
|
||||
_context.jobQueue().addJob(new DistributeLocal(toDest, runner, sender, fromDest, payload, msgId));
|
||||
_ctx.jobQueue().addJob(new DistributeLocal(toDest, runner, sender, fromDest, payload, msgId));
|
||||
} else {
|
||||
// remote. w00t
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -167,7 +167,7 @@ public class ClientManager {
|
||||
msg.setSenderConfig(runner.getConfig());
|
||||
msg.setFromDestination(runner.getConfig().getDestination());
|
||||
msg.setMessageId(msgId);
|
||||
_context.clientMessagePool().add(msg, true);
|
||||
_ctx.clientMessagePool().add(msg, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ public class ClientManager {
|
||||
private MessageId _msgId;
|
||||
|
||||
public DistributeLocal(Destination toDest, ClientConnectionRunner to, ClientConnectionRunner from, Destination fromDest, Payload payload, MessageId id) {
|
||||
super(_context);
|
||||
super(_ctx);
|
||||
_toDest = toDest;
|
||||
_to = to;
|
||||
_from = from;
|
||||
@ -217,22 +217,22 @@ public class ClientManager {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.warn("Cannot request the lease set, as we can't find a client runner for "
|
||||
+ dest.calculateHash().toBase64() + ". disconnected?");
|
||||
_context.jobQueue().addJob(onFailedJob);
|
||||
_ctx.jobQueue().addJob(onFailedJob);
|
||||
} else {
|
||||
runner.requestLeaseSet(set, _context.clock().now() + timeout, onCreateJob, onFailedJob);
|
||||
runner.requestLeaseSet(set, _ctx.clock().now() + timeout, onCreateJob, onFailedJob);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isLocal(Destination dest) {
|
||||
boolean rv = false;
|
||||
long beforeLock = _context.clock().now();
|
||||
long beforeLock = _ctx.clock().now();
|
||||
long inLock = 0;
|
||||
synchronized (_runners) {
|
||||
inLock = _context.clock().now();
|
||||
inLock = _ctx.clock().now();
|
||||
rv = _runners.containsKey(dest);
|
||||
}
|
||||
long afterLock = _context.clock().now();
|
||||
long afterLock = _ctx.clock().now();
|
||||
|
||||
if (afterLock - beforeLock > 50) {
|
||||
_log.warn("isLocal(Destination).locking took too long: " + (afterLock-beforeLock)
|
||||
@ -243,13 +243,13 @@ public class ClientManager {
|
||||
public boolean isLocal(Hash destHash) {
|
||||
if (destHash == null) return false;
|
||||
Set dests = new HashSet();
|
||||
long beforeLock = _context.clock().now();
|
||||
long beforeLock = _ctx.clock().now();
|
||||
long inLock = 0;
|
||||
synchronized (_runners) {
|
||||
inLock = _context.clock().now();
|
||||
inLock = _ctx.clock().now();
|
||||
dests.addAll(_runners.keySet());
|
||||
}
|
||||
long afterLock = _context.clock().now();
|
||||
long afterLock = _ctx.clock().now();
|
||||
if (afterLock - beforeLock > 50) {
|
||||
_log.warn("isLocal(Hash).locking took too long: " + (afterLock-beforeLock)
|
||||
+ " overall, synchronized took " + (inLock - beforeLock));
|
||||
@ -263,13 +263,13 @@ public class ClientManager {
|
||||
|
||||
ClientConnectionRunner getRunner(Destination dest) {
|
||||
ClientConnectionRunner rv = null;
|
||||
long beforeLock = _context.clock().now();
|
||||
long beforeLock = _ctx.clock().now();
|
||||
long inLock = 0;
|
||||
synchronized (_runners) {
|
||||
inLock = _context.clock().now();
|
||||
inLock = _ctx.clock().now();
|
||||
rv = (ClientConnectionRunner)_runners.get(dest);
|
||||
}
|
||||
long afterLock = _context.clock().now();
|
||||
long afterLock = _ctx.clock().now();
|
||||
if (afterLock - beforeLock > 50) {
|
||||
_log.warn("getRunner(Dest).locking took too long: " + (afterLock-beforeLock)
|
||||
+ " overall, synchronized took " + (inLock - beforeLock));
|
||||
@ -293,13 +293,13 @@ public class ClientManager {
|
||||
if (destHash == null)
|
||||
return null;
|
||||
Set dests = new HashSet();
|
||||
long beforeLock = _context.clock().now();
|
||||
long beforeLock = _ctx.clock().now();
|
||||
long inLock = 0;
|
||||
synchronized (_runners) {
|
||||
inLock = _context.clock().now();
|
||||
inLock = _ctx.clock().now();
|
||||
dests.addAll(_runners.keySet());
|
||||
}
|
||||
long afterLock = _context.clock().now();
|
||||
long afterLock = _ctx.clock().now();
|
||||
if (afterLock - beforeLock > 50) {
|
||||
_log.warn("getRunner(Hash).locking took too long: " + (afterLock-beforeLock)
|
||||
+ " overall, synchronized took " + (inLock - beforeLock));
|
||||
@ -329,13 +329,13 @@ public class ClientManager {
|
||||
|
||||
Set getRunnerDestinations() {
|
||||
Set dests = new HashSet();
|
||||
long beforeLock = _context.clock().now();
|
||||
long beforeLock = _ctx.clock().now();
|
||||
long inLock = 0;
|
||||
synchronized (_runners) {
|
||||
inLock = _context.clock().now();
|
||||
inLock = _ctx.clock().now();
|
||||
dests.addAll(_runners.keySet());
|
||||
}
|
||||
long afterLock = _context.clock().now();
|
||||
long afterLock = _ctx.clock().now();
|
||||
if (afterLock - beforeLock > 50) {
|
||||
_log.warn("getRunnerDestinations().locking took too long: " + (afterLock-beforeLock)
|
||||
+ " overall, synchronized took " + (inLock - beforeLock));
|
||||
@ -375,7 +375,7 @@ public class ClientManager {
|
||||
if (ls == null) {
|
||||
buf.append("<font color=\"red\"><i>No lease</i></font><br />\n");
|
||||
} else {
|
||||
long leaseAge = ls.getEarliestLeaseDate() - _context.clock().now();
|
||||
long leaseAge = ls.getEarliestLeaseDate() - _ctx.clock().now();
|
||||
if (leaseAge <= 0) {
|
||||
buf.append("<font color=\"red\"><i>Lease expired ");
|
||||
buf.append(DataHelper.formatDuration(0-leaseAge)).append(" ago</i></font><br />\n");
|
||||
@ -385,7 +385,7 @@ public class ClientManager {
|
||||
buf.append("<font color=\"red\"><i>No tunnels</i></font><br />\n");
|
||||
} else {
|
||||
TunnelId id = ls.getLease(0).getTunnelId();
|
||||
TunnelInfo info = _context.tunnelManager().getTunnelInfo(id);
|
||||
TunnelInfo info = _ctx.tunnelManager().getTunnelInfo(id);
|
||||
if (info == null) {
|
||||
buf.append("<font color=\"red\"><i>Failed tunnels</i></font><br />\n");
|
||||
} else {
|
||||
@ -408,13 +408,13 @@ public class ClientManager {
|
||||
}
|
||||
|
||||
public void messageReceived(ClientMessage msg) {
|
||||
_context.jobQueue().addJob(new HandleJob(msg));
|
||||
_ctx.jobQueue().addJob(new HandleJob(msg));
|
||||
}
|
||||
|
||||
private class HandleJob extends JobImpl {
|
||||
private ClientMessage _msg;
|
||||
public HandleJob(ClientMessage msg) {
|
||||
super(_context);
|
||||
super(_ctx);
|
||||
_msg = msg;
|
||||
}
|
||||
public String getName() { return "Handle Inbound Client Messages"; }
|
||||
@ -426,7 +426,7 @@ public class ClientManager {
|
||||
runner = getRunner(_msg.getDestinationHash());
|
||||
|
||||
if (runner != null) {
|
||||
_context.statManager().addRateData("client.receiveMessageSize",
|
||||
_ctx.statManager().addRateData("client.receiveMessageSize",
|
||||
_msg.getPayload().getSize(), 0);
|
||||
runner.receiveMessage(_msg.getDestination(), null, _msg.getPayload());
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ class RequestLeaseSetJob extends JobImpl {
|
||||
try {
|
||||
_runner.setLeaseRequest(state);
|
||||
_runner.doSend(msg);
|
||||
getContext().jobQueue().addJob(new CheckLeaseRequestStatus(state));
|
||||
getContext().jobQueue().addJob(new CheckLeaseRequestStatus(getContext(), state));
|
||||
return;
|
||||
} catch (I2CPMessageException ime) {
|
||||
_log.error("Error sending I2CP message requesting the lease set", ime);
|
||||
@ -96,8 +96,8 @@ class RequestLeaseSetJob extends JobImpl {
|
||||
private class CheckLeaseRequestStatus extends JobImpl {
|
||||
private LeaseRequestState _req;
|
||||
|
||||
public CheckLeaseRequestStatus(LeaseRequestState state) {
|
||||
super(RequestLeaseSetJob.this.getContext());
|
||||
public CheckLeaseRequestStatus(RouterContext enclosingContext, LeaseRequestState state) {
|
||||
super(enclosingContext);
|
||||
_req = state;
|
||||
getTiming().setStartAfter(state.getExpiration());
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
_log.debug("We are the gateway to tunnel " + info.getTunnelId().getTunnelId());
|
||||
byte data[] = _message.getData();
|
||||
I2NPMessage msg = getBody(data);
|
||||
getContext().jobQueue().addJob(new HandleGatewayMessageJob(msg, info, data.length));
|
||||
getContext().jobQueue().addJob(new HandleGatewayMessageJob(getContext(), msg, info, data.length));
|
||||
return;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -158,7 +158,7 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
|
||||
I2NPMessage body = getBody(_message.getData());
|
||||
if (body != null) {
|
||||
getContext().jobQueue().addJob(new HandleLocallyJob(body, info));
|
||||
getContext().jobQueue().addJob(new HandleLocallyJob(getContext(), body, info));
|
||||
return;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
@ -226,7 +226,7 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("No more hops, unwrap and follow the instructions");
|
||||
getContext().jobQueue().addJob(new HandleEndpointJob(info));
|
||||
getContext().jobQueue().addJob(new HandleEndpointJob(getContext(), info));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
_log.error("Unable to recover the body from the tunnel", getAddedBy());
|
||||
return;
|
||||
} else {
|
||||
getContext().jobQueue().addJob(new ProcessBodyLocallyJob(body, instructions, ourPlace));
|
||||
getContext().jobQueue().addJob(new ProcessBodyLocallyJob(getContext(), body, instructions, ourPlace));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -545,8 +545,8 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
private int _length;
|
||||
private TunnelInfo _info;
|
||||
|
||||
public HandleGatewayMessageJob(I2NPMessage body, TunnelInfo tunnel, int length) {
|
||||
super(HandleTunnelMessageJob.this.getContext());
|
||||
public HandleGatewayMessageJob(RouterContext enclosingContext, I2NPMessage body, TunnelInfo tunnel, int length) {
|
||||
super(enclosingContext);
|
||||
_body = body;
|
||||
_length = length;
|
||||
_info = tunnel;
|
||||
@ -587,8 +587,8 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
private I2NPMessage _body;
|
||||
private TunnelInfo _info;
|
||||
|
||||
public HandleLocallyJob(I2NPMessage body, TunnelInfo tunnel) {
|
||||
super(HandleTunnelMessageJob.this.getContext());
|
||||
public HandleLocallyJob(RouterContext enclosingContext, I2NPMessage body, TunnelInfo tunnel) {
|
||||
super(enclosingContext);
|
||||
_body = body;
|
||||
_info = tunnel;
|
||||
}
|
||||
@ -622,8 +622,8 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
/** we're the endpoint of the inbound tunnel */
|
||||
private class HandleEndpointJob extends JobImpl {
|
||||
private TunnelInfo _info;
|
||||
public HandleEndpointJob(TunnelInfo info) {
|
||||
super(HandleTunnelMessageJob.this.getContext());
|
||||
public HandleEndpointJob(RouterContext enclosingContext, TunnelInfo info) {
|
||||
super(enclosingContext);
|
||||
_info = info;
|
||||
}
|
||||
public void runJob() {
|
||||
@ -637,8 +637,8 @@ public class HandleTunnelMessageJob extends JobImpl {
|
||||
private I2NPMessage _body;
|
||||
private TunnelInfo _ourPlace;
|
||||
private DeliveryInstructions _instructions;
|
||||
public ProcessBodyLocallyJob(I2NPMessage body, DeliveryInstructions instructions, TunnelInfo ourPlace) {
|
||||
super(HandleTunnelMessageJob.this.getContext());
|
||||
public ProcessBodyLocallyJob(RouterContext enclosingContext, I2NPMessage body, DeliveryInstructions instructions, TunnelInfo ourPlace) {
|
||||
super(enclosingContext);
|
||||
_body = body;
|
||||
_instructions = instructions;
|
||||
_ourPlace = ourPlace;
|
||||
|
@ -129,8 +129,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
|
||||
_overallExpiration = timeoutMs + getContext().clock().now();
|
||||
_status = new OutboundClientMessageStatus(ctx, msg);
|
||||
_nextStep = new NextStepJob();
|
||||
_lookupLeaseSetFailed = new LookupLeaseSetFailedJob();
|
||||
_nextStep = new NextStepJob(getContext());
|
||||
_lookupLeaseSetFailed = new LookupLeaseSetFailedJob(getContext());
|
||||
_shouldBundle = getShouldBundle();
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
getContext().netDb().fail(to); // so we don't just fetch what we have
|
||||
getContext().netDb().lookupLeaseSet(to, _nextStep, _lookupLeaseSetFailed, remainingMs);
|
||||
if (ls != null)
|
||||
getContext().jobQueue().addJob(new ShortCircuitSearchJob(ls));
|
||||
getContext().jobQueue().addJob(new ShortCircuitSearchJob(getContext(), ls));
|
||||
return;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@ -218,7 +218,7 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
}
|
||||
}
|
||||
|
||||
getContext().jobQueue().addJob(new SendJob(nextLease));
|
||||
getContext().jobQueue().addJob(new SendJob(getContext(), nextLease));
|
||||
}
|
||||
|
||||
private static final long MAX_SEARCH_INTERVAL = 10*1000;
|
||||
@ -229,8 +229,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
*/
|
||||
private class ShortCircuitSearchJob extends JobImpl {
|
||||
private LeaseSet _ls;
|
||||
public ShortCircuitSearchJob(LeaseSet ls) {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public ShortCircuitSearchJob(RouterContext enclosingContext, LeaseSet ls) {
|
||||
super(enclosingContext);
|
||||
_ls = ls;
|
||||
ShortCircuitSearchJob.this.getTiming().setStartAfter(getContext().clock().now() + MAX_SEARCH_INTERVAL);
|
||||
}
|
||||
@ -368,8 +368,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
|
||||
_status.sent(lease.getRouterIdentity().getHash(), lease.getTunnelId());
|
||||
|
||||
SendSuccessJob onReply = new SendSuccessJob(lease, sessKey, tags);
|
||||
SendTimeoutJob onFail = new SendTimeoutJob(lease);
|
||||
SendSuccessJob onReply = new SendSuccessJob(getContext(), lease, sessKey, tags);
|
||||
SendTimeoutJob onFail = new SendTimeoutJob(getContext(), lease);
|
||||
ReplySelector selector = new ReplySelector(token);
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -512,8 +512,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
|
||||
/** queued by the db lookup success and the send timeout to get us to try the next lease */
|
||||
private class NextStepJob extends JobImpl {
|
||||
public NextStepJob() {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public NextStepJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Process next step for outbound client message"; }
|
||||
public void runJob() { sendNext(); }
|
||||
@ -525,8 +525,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
*
|
||||
*/
|
||||
private class LookupLeaseSetFailedJob extends JobImpl {
|
||||
public LookupLeaseSetFailedJob() {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public LookupLeaseSetFailedJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Lookup for outbound client message failed"; }
|
||||
public void runJob() {
|
||||
@ -538,8 +538,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
/** send a message to a lease */
|
||||
private class SendJob extends JobImpl {
|
||||
private Lease _lease;
|
||||
public SendJob(Lease lease) {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public SendJob(RouterContext enclosingContext, Lease lease) {
|
||||
super(enclosingContext);
|
||||
_lease = lease;
|
||||
}
|
||||
public String getName() { return "Send outbound client message through the lease"; }
|
||||
@ -561,8 +561,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
* the given session key and bearing the specified tags are confirmed delivered.
|
||||
*
|
||||
*/
|
||||
public SendSuccessJob(Lease lease, SessionKey key, Set tags) {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public SendSuccessJob(RouterContext enclosingContext, Lease lease, SessionKey key, Set tags) {
|
||||
super(enclosingContext);
|
||||
_lease = lease;
|
||||
_key = key;
|
||||
_tags = tags;
|
||||
@ -615,8 +615,8 @@ public class OutboundClientMessageJob extends JobImpl {
|
||||
private class SendTimeoutJob extends JobImpl {
|
||||
private Lease _lease;
|
||||
|
||||
public SendTimeoutJob(Lease lease) {
|
||||
super(OutboundClientMessageJob.this.getContext());
|
||||
public SendTimeoutJob(RouterContext enclosingContext, Lease lease) {
|
||||
super(enclosingContext);
|
||||
_lease = lease;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
long timeoutMs = _overallExpiration - getContext().clock().now();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Send outbound client message - sending off leaseSet lookup job");
|
||||
getContext().netDb().lookupLeaseSet(_to.calculateHash(), new SendJob(), new LookupLeaseSetFailedJob(), timeoutMs);
|
||||
getContext().netDb().lookupLeaseSet(_to.calculateHash(), new SendJob(getContext()), new LookupLeaseSetFailedJob(getContext()), timeoutMs);
|
||||
}
|
||||
|
||||
private boolean getShouldBundle() {
|
||||
@ -177,8 +177,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
|
||||
/** send a message to a random lease */
|
||||
private class SendJob extends JobImpl {
|
||||
public SendJob() {
|
||||
super(OutboundClientMessageOneShotJob.this.getContext());
|
||||
public SendJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Send outbound client message through the lease"; }
|
||||
public void runJob() {
|
||||
@ -251,8 +251,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
*
|
||||
*/
|
||||
private class LookupLeaseSetFailedJob extends JobImpl {
|
||||
public LookupLeaseSetFailedJob() {
|
||||
super(OutboundClientMessageOneShotJob.this.getContext());
|
||||
public LookupLeaseSetFailedJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Lookup for outbound client message failed"; }
|
||||
public void runJob() {
|
||||
@ -289,8 +289,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": send() - token expected " + token);
|
||||
|
||||
SendSuccessJob onReply = new SendSuccessJob(sessKey, tags);
|
||||
SendTimeoutJob onFail = new SendTimeoutJob();
|
||||
SendSuccessJob onReply = new SendSuccessJob(getContext(), sessKey, tags);
|
||||
SendTimeoutJob onFail = new SendTimeoutJob(getContext());
|
||||
ReplySelector selector = new ReplySelector(token);
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -433,8 +433,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
* the given session key and bearing the specified tags are confirmed delivered.
|
||||
*
|
||||
*/
|
||||
public SendSuccessJob(SessionKey key, Set tags) {
|
||||
super(OutboundClientMessageOneShotJob.this.getContext());
|
||||
public SendSuccessJob(RouterContext enclosingContext, SessionKey key, Set tags) {
|
||||
super(enclosingContext);
|
||||
_key = key;
|
||||
_tags = tags;
|
||||
}
|
||||
@ -473,8 +473,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
*
|
||||
*/
|
||||
private class SendTimeoutJob extends JobImpl {
|
||||
public SendTimeoutJob() {
|
||||
super(OutboundClientMessageOneShotJob.this.getContext());
|
||||
public SendTimeoutJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
|
||||
public String getName() { return "Send client message timed out through a lease"; }
|
||||
|
@ -84,12 +84,12 @@ public class SendGarlicJob extends JobImpl {
|
||||
} else {
|
||||
_log.debug("Building the garlic was fast! " + (after - before) + " ms");
|
||||
}
|
||||
getContext().jobQueue().addJob(new SendJob());
|
||||
getContext().jobQueue().addJob(new SendJob(getContext()));
|
||||
}
|
||||
|
||||
private class SendJob extends JobImpl {
|
||||
public SendJob() {
|
||||
super(SendGarlicJob.this.getContext());
|
||||
public SendJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Send Built Garlic Message"; }
|
||||
public void runJob() {
|
||||
|
@ -218,7 +218,7 @@ class SearchJob extends JobImpl {
|
||||
}
|
||||
private void requeuePending(long ms) {
|
||||
if (_pendingRequeueJob == null)
|
||||
_pendingRequeueJob = new RequeuePending();
|
||||
_pendingRequeueJob = new RequeuePending(getContext());
|
||||
long now = getContext().clock().now();
|
||||
if (_pendingRequeueJob.getTiming().getStartAfter() < now)
|
||||
_pendingRequeueJob.getTiming().setStartAfter(now+ms);
|
||||
@ -226,8 +226,8 @@ class SearchJob extends JobImpl {
|
||||
}
|
||||
|
||||
private class RequeuePending extends JobImpl {
|
||||
public RequeuePending() {
|
||||
super(SearchJob.this.getContext());
|
||||
public RequeuePending(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Requeue search with pending"; }
|
||||
public void runJob() { searchNext(); }
|
||||
@ -279,7 +279,7 @@ class SearchJob extends JobImpl {
|
||||
TunnelId inTunnelId = getInboundTunnelId();
|
||||
if (inTunnelId == null) {
|
||||
_log.error("No tunnels to get search replies through! wtf!");
|
||||
getContext().jobQueue().addJob(new FailedJob(router));
|
||||
getContext().jobQueue().addJob(new FailedJob(getContext(), router));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ class SearchJob extends JobImpl {
|
||||
RouterInfo inGateway = getContext().netDb().lookupRouterInfoLocally(inTunnel.getThisHop());
|
||||
if (inGateway == null) {
|
||||
_log.error("We can't find the gateway to our inbound tunnel?! wtf");
|
||||
getContext().jobQueue().addJob(new FailedJob(router));
|
||||
getContext().jobQueue().addJob(new FailedJob(getContext(), router));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ class SearchJob extends JobImpl {
|
||||
TunnelId outTunnelId = getOutboundTunnelId();
|
||||
if (outTunnelId == null) {
|
||||
_log.error("No tunnels to send search out through! wtf!");
|
||||
getContext().jobQueue().addJob(new FailedJob(router));
|
||||
getContext().jobQueue().addJob(new FailedJob(getContext(), router));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ class SearchJob extends JobImpl {
|
||||
SearchMessageSelector sel = new SearchMessageSelector(getContext(), router, _expiration, _state);
|
||||
SearchUpdateReplyFoundJob reply = new SearchUpdateReplyFoundJob(getContext(), router, _state, _facade, this);
|
||||
SendTunnelMessageJob j = new SendTunnelMessageJob(getContext(), msg, outTunnelId, router.getIdentity().getHash(),
|
||||
null, null, reply, new FailedJob(router), sel,
|
||||
null, null, reply, new FailedJob(getContext(), router), sel,
|
||||
PER_PEER_TIMEOUT, SEARCH_PRIORITY);
|
||||
getContext().jobQueue().addJob(j);
|
||||
}
|
||||
@ -329,7 +329,7 @@ class SearchJob extends JobImpl {
|
||||
SearchMessageSelector sel = new SearchMessageSelector(getContext(), router, _expiration, _state);
|
||||
SearchUpdateReplyFoundJob reply = new SearchUpdateReplyFoundJob(getContext(), router, _state, _facade, this);
|
||||
SendMessageDirectJob j = new SendMessageDirectJob(getContext(), msg, router.getIdentity().getHash(),
|
||||
reply, new FailedJob(router), sel, PER_PEER_TIMEOUT, SEARCH_PRIORITY);
|
||||
reply, new FailedJob(getContext(), router), sel, PER_PEER_TIMEOUT, SEARCH_PRIORITY);
|
||||
getContext().jobQueue().addJob(j);
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ class SearchJob extends JobImpl {
|
||||
void replyFound(DatabaseSearchReplyMessage message, Hash peer) {
|
||||
long duration = _state.replyFound(peer);
|
||||
// this processing can take a while, so split 'er up
|
||||
getContext().jobQueue().addJob(new SearchReplyJob((DatabaseSearchReplyMessage)message, peer, duration));
|
||||
getContext().jobQueue().addJob(new SearchReplyJob(getContext(), (DatabaseSearchReplyMessage)message, peer, duration));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,8 +432,8 @@ class SearchJob extends JobImpl {
|
||||
private int _duplicatePeers;
|
||||
private int _repliesPendingVerification;
|
||||
private long _duration;
|
||||
public SearchReplyJob(DatabaseSearchReplyMessage message, Hash peer, long duration) {
|
||||
super(SearchJob.this.getContext());
|
||||
public SearchReplyJob(RouterContext enclosingContext, DatabaseSearchReplyMessage message, Hash peer, long duration) {
|
||||
super(enclosingContext);
|
||||
_msg = message;
|
||||
_peer = peer;
|
||||
_curIndex = 0;
|
||||
@ -468,7 +468,7 @@ class SearchJob extends JobImpl {
|
||||
|
||||
boolean sendsBadInfo = getContext().profileOrganizer().peerSendsBadReplies(_peer);
|
||||
if (!sendsBadInfo) {
|
||||
getContext().netDb().lookupRouterInfo(peer, new ReplyVerifiedJob(peer), new ReplyNotVerifiedJob(peer), _timeoutMs);
|
||||
getContext().netDb().lookupRouterInfo(peer, new ReplyVerifiedJob(getContext(), peer), new ReplyNotVerifiedJob(getContext(), peer), _timeoutMs);
|
||||
_repliesPendingVerification++;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@ -496,8 +496,8 @@ class SearchJob extends JobImpl {
|
||||
/** the peer gave us a reference to a new router, and we were able to fetch it */
|
||||
private final class ReplyVerifiedJob extends JobImpl {
|
||||
private Hash _key;
|
||||
public ReplyVerifiedJob(Hash key) {
|
||||
super(SearchReplyJob.this.getContext());
|
||||
public ReplyVerifiedJob(RouterContext enclosingContext, Hash key) {
|
||||
super(enclosingContext);
|
||||
_key = key;
|
||||
}
|
||||
public String getName() { return "Search reply value verified"; }
|
||||
@ -511,8 +511,8 @@ class SearchJob extends JobImpl {
|
||||
/** the peer gave us a reference to a new router, and we were NOT able to fetch it */
|
||||
private final class ReplyNotVerifiedJob extends JobImpl {
|
||||
private Hash _key;
|
||||
public ReplyNotVerifiedJob(Hash key) {
|
||||
super(SearchReplyJob.this.getContext());
|
||||
public ReplyNotVerifiedJob(RouterContext enclosingContext, Hash key) {
|
||||
super(enclosingContext);
|
||||
_key = key;
|
||||
}
|
||||
public String getName() { return "Search reply value NOT verified"; }
|
||||
@ -534,16 +534,16 @@ class SearchJob extends JobImpl {
|
||||
protected class FailedJob extends JobImpl {
|
||||
private Hash _peer;
|
||||
private boolean _penalizePeer;
|
||||
public FailedJob(RouterInfo peer) {
|
||||
this(peer, true);
|
||||
public FailedJob(RouterContext enclosingContext, RouterInfo peer) {
|
||||
this(enclosingContext, peer, true);
|
||||
}
|
||||
/**
|
||||
* Allow the choice as to whether failed searches should count against
|
||||
* the peer (such as if we search for a random key)
|
||||
*
|
||||
*/
|
||||
public FailedJob(RouterInfo peer, boolean penalizePeer) {
|
||||
super(SearchJob.this.getContext());
|
||||
public FailedJob(RouterContext enclosingContext, RouterInfo peer, boolean penalizePeer) {
|
||||
super(enclosingContext);
|
||||
_penalizePeer = penalizePeer;
|
||||
_peer = peer.getIdentity().getHash();
|
||||
}
|
||||
|
@ -231,8 +231,8 @@ class StoreJob extends JobImpl {
|
||||
|
||||
_state.addPending(peer.getIdentity().getHash());
|
||||
|
||||
SendSuccessJob onReply = new SendSuccessJob(peer);
|
||||
FailedJob onFail = new FailedJob(peer);
|
||||
SendSuccessJob onReply = new SendSuccessJob(getContext(), peer);
|
||||
FailedJob onFail = new FailedJob(getContext(), peer);
|
||||
StoreMessageSelector selector = new StoreMessageSelector(getContext(), getJobId(), peer, token, expiration);
|
||||
|
||||
TunnelId outTunnelId = selectOutboundTunnel();
|
||||
@ -295,8 +295,8 @@ class StoreJob extends JobImpl {
|
||||
private class SendSuccessJob extends JobImpl implements ReplyJob {
|
||||
private RouterInfo _peer;
|
||||
|
||||
public SendSuccessJob(RouterInfo peer) {
|
||||
super(StoreJob.this.getContext());
|
||||
public SendSuccessJob(RouterContext enclosingContext, RouterInfo peer) {
|
||||
super(enclosingContext);
|
||||
_peer = peer;
|
||||
}
|
||||
|
||||
@ -329,8 +329,8 @@ class StoreJob extends JobImpl {
|
||||
private class FailedJob extends JobImpl {
|
||||
private RouterInfo _peer;
|
||||
|
||||
public FailedJob(RouterInfo peer) {
|
||||
super(StoreJob.this.getContext());
|
||||
public FailedJob(RouterContext enclosingContext, RouterInfo peer) {
|
||||
super(enclosingContext);
|
||||
_peer = peer;
|
||||
}
|
||||
public void runJob() {
|
||||
|
@ -24,14 +24,14 @@ class PersistProfilesJob extends JobImpl {
|
||||
int i = 0;
|
||||
for (Iterator iter = peers.iterator(); iter.hasNext(); )
|
||||
hashes[i] = (Hash)iter.next();
|
||||
getContext().jobQueue().addJob(new PersistProfileJob(hashes));
|
||||
getContext().jobQueue().addJob(new PersistProfileJob(getContext(), hashes));
|
||||
}
|
||||
|
||||
private class PersistProfileJob extends JobImpl {
|
||||
private Hash _peers[];
|
||||
private int _cur;
|
||||
public PersistProfileJob(Hash peers[]) {
|
||||
super(PersistProfilesJob.this.getContext());
|
||||
public PersistProfileJob(RouterContext enclosingContext, Hash peers[]) {
|
||||
super(enclosingContext);
|
||||
_peers = peers;
|
||||
_cur = 0;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class LoadClientAppsJob extends JobImpl {
|
||||
runClient(className, clientName, argVal);
|
||||
} else {
|
||||
// wait before firing it up
|
||||
getContext().jobQueue().addJob(new DelayedRunClient(className, clientName, argVal, delay));
|
||||
getContext().jobQueue().addJob(new DelayedRunClient(getContext(), className, clientName, argVal, delay));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -90,8 +90,8 @@ class LoadClientAppsJob extends JobImpl {
|
||||
private String _className;
|
||||
private String _clientName;
|
||||
private String _args[];
|
||||
public DelayedRunClient(String className, String clientName, String args[], long delay) {
|
||||
super(LoadClientAppsJob.this.getContext());
|
||||
public DelayedRunClient(RouterContext enclosingContext, String className, String clientName, String args[], long delay) {
|
||||
super(enclosingContext);
|
||||
_className = className;
|
||||
_clientName = clientName;
|
||||
_args = args;
|
||||
|
@ -164,7 +164,7 @@ class ClientLeaseSetManagerJob extends JobImpl {
|
||||
private void requestNewLeaseSet() {
|
||||
LeaseSet proposed = buildNewLeaseSet();
|
||||
getContext().clientManager().requestLeaseSet(_pool.getDestination(), proposed,
|
||||
REQUEST_LEASE_TIMEOUT, new LeaseSetCreatedJob(),
|
||||
REQUEST_LEASE_TIMEOUT, new LeaseSetCreatedJob(getContext()),
|
||||
null);
|
||||
}
|
||||
|
||||
@ -213,8 +213,8 @@ class ClientLeaseSetManagerJob extends JobImpl {
|
||||
}
|
||||
|
||||
private class LeaseSetCreatedJob extends JobImpl {
|
||||
public LeaseSetCreatedJob() {
|
||||
super(ClientLeaseSetManagerJob.this.getContext());
|
||||
public LeaseSetCreatedJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "LeaseSet created"; }
|
||||
public void runJob() {
|
||||
|
@ -242,7 +242,7 @@ class ClientTunnelPoolManagerJob extends JobImpl {
|
||||
*/
|
||||
private void requestCustomTunnels(int numTunnels) {
|
||||
for (int i = 0; i < numTunnels; i++) {
|
||||
getContext().jobQueue().addJob(new RequestCustomTunnelJob());
|
||||
getContext().jobQueue().addJob(new RequestCustomTunnelJob(getContext()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,8 +252,8 @@ class ClientTunnelPoolManagerJob extends JobImpl {
|
||||
*
|
||||
*/
|
||||
private class RequestCustomTunnelJob extends JobImpl {
|
||||
public RequestCustomTunnelJob() {
|
||||
super(ClientTunnelPoolManagerJob.this.getContext());
|
||||
public RequestCustomTunnelJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
public String getName() { return "Request Custom Client Tunnel"; }
|
||||
public void runJob() {
|
||||
|
@ -89,7 +89,7 @@ public class HandleTunnelCreateMessageJob extends JobImpl {
|
||||
boolean ok = getContext().tunnelManager().joinTunnel(info);
|
||||
sendReply(ok);
|
||||
} else {
|
||||
getContext().netDb().lookupRouterInfo(info.getNextHop(), new TestJob(info), new JoinJob(info, false), TIMEOUT);
|
||||
getContext().netDb().lookupRouterInfo(info.getNextHop(), new TestJob(getContext(), info), new JoinJob(getContext(), info, false), TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,8 +105,8 @@ public class HandleTunnelCreateMessageJob extends JobImpl {
|
||||
|
||||
private class TestJob extends JobImpl {
|
||||
private TunnelInfo _target;
|
||||
public TestJob(TunnelInfo target) {
|
||||
super(HandleTunnelCreateMessageJob.this.getContext());
|
||||
public TestJob(RouterContext enclosingContext, TunnelInfo target) {
|
||||
super(enclosingContext);
|
||||
_target = target;
|
||||
}
|
||||
|
||||
@ -121,8 +121,8 @@ public class HandleTunnelCreateMessageJob extends JobImpl {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Lookup successful for tested peer " + _target.toBase64() + ", now continue with the test");
|
||||
Hash peer = TestJob.this.getContext().routerHash();
|
||||
JoinJob success = new JoinJob(_target, true);
|
||||
JoinJob failure = new JoinJob(_target, false);
|
||||
JoinJob success = new JoinJob(getContext(), _target, true);
|
||||
JoinJob failure = new JoinJob(getContext(), _target, false);
|
||||
BuildTestMessageJob test = new BuildTestMessageJob(TestJob.this.getContext(), info, peer, success, failure, TIMEOUT, PRIORITY);
|
||||
TestJob.this.getContext().jobQueue().addJob(test);
|
||||
}
|
||||
@ -240,8 +240,8 @@ public class HandleTunnelCreateMessageJob extends JobImpl {
|
||||
private class JoinJob extends JobImpl {
|
||||
private TunnelInfo _info;
|
||||
private boolean _isReachable;
|
||||
public JoinJob(TunnelInfo info, boolean isReachable) {
|
||||
super(HandleTunnelCreateMessageJob.this.getContext());
|
||||
public JoinJob(RouterContext enclosingContext, TunnelInfo info, boolean isReachable) {
|
||||
super(enclosingContext);
|
||||
_info = info;
|
||||
_isReachable = isReachable;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class RequestTunnelJob extends JobImpl {
|
||||
RequestState state = new RequestState(wrappedKey, wrappedTags, wrappedTo,
|
||||
participant, inboundGateway,
|
||||
outboundTunnel, target);
|
||||
Request r = new Request(state);
|
||||
Request r = new Request(getContext(), state);
|
||||
getContext().jobQueue().addJob(r);
|
||||
}
|
||||
|
||||
@ -188,8 +188,8 @@ public class RequestTunnelJob extends JobImpl {
|
||||
*/
|
||||
public class Request extends JobImpl {
|
||||
private RequestState _state;
|
||||
Request(RequestState state) {
|
||||
super(RequestTunnelJob.this.getContext());
|
||||
Request(RouterContext enclosingContext, RequestState state) {
|
||||
super(enclosingContext);
|
||||
_state = state;
|
||||
}
|
||||
|
||||
@ -260,8 +260,8 @@ public class RequestTunnelJob extends JobImpl {
|
||||
_log.info("Sending tunnel create to " + _target.getIdentity().getHash().toBase64() +
|
||||
" to inbound gateway " + _inboundGateway.getGateway().toBase64() +
|
||||
" : " + _inboundGateway.getTunnelId().getTunnelId());
|
||||
ReplyJob onReply = new Success(_participant, _wrappedKey, _wrappedTags, _wrappedTo, _inboundGateway.getTunnelId(), _outboundTunnel);
|
||||
Job onFail = new Failure(_participant, _inboundGateway.getTunnelId(), _outboundTunnel);
|
||||
ReplyJob onReply = new Success(getContext(), _participant, _wrappedKey, _wrappedTags, _wrappedTo, _inboundGateway.getTunnelId(), _outboundTunnel);
|
||||
Job onFail = new Failure(getContext(), _participant, _inboundGateway.getTunnelId(), _outboundTunnel);
|
||||
MessageSelector selector = new Selector(_participant);
|
||||
SendTunnelMessageJob j = new SendTunnelMessageJob(getContext(), _garlicMessage,
|
||||
_outboundTunnel, _target.getIdentity().getHash(),
|
||||
@ -554,8 +554,8 @@ public class RequestTunnelJob extends JobImpl {
|
||||
private TunnelId _outboundTunnelId;
|
||||
private long _started;
|
||||
|
||||
public Success(TunnelInfo tunnel, SessionKey wrappedKey, Set wrappedTags, PublicKey wrappedTo, TunnelId replyTunnelId, TunnelId outboundTunnelId) {
|
||||
super(RequestTunnelJob.this.getContext());
|
||||
public Success(RouterContext enclosingContext, TunnelInfo tunnel, SessionKey wrappedKey, Set wrappedTags, PublicKey wrappedTo, TunnelId replyTunnelId, TunnelId outboundTunnelId) {
|
||||
super(enclosingContext);
|
||||
_tunnel = tunnel;
|
||||
_messages = new LinkedList();
|
||||
_successCompleted = false;
|
||||
@ -651,8 +651,8 @@ public class RequestTunnelJob extends JobImpl {
|
||||
private TunnelId _outboundTunnelId;
|
||||
private TunnelId _replyTunnelId;
|
||||
private long _started;
|
||||
public Failure(TunnelInfo tunnel, TunnelId replyTunnelId, TunnelId outboundTunnelId) {
|
||||
super(RequestTunnelJob.this.getContext());
|
||||
public Failure(RouterContext enclosingContext, TunnelInfo tunnel, TunnelId replyTunnelId, TunnelId outboundTunnelId) {
|
||||
super(enclosingContext);
|
||||
_tunnel = tunnel;
|
||||
_replyTunnelId = replyTunnelId;
|
||||
_outboundTunnelId = outboundTunnelId;
|
||||
|
@ -157,7 +157,7 @@ class TestTunnelJob extends JobImpl {
|
||||
Hash us = getContext().routerHash();
|
||||
_secondaryId = getReplyTunnel();
|
||||
if (_secondaryId == null) {
|
||||
getContext().jobQueue().addJob(new TestFailedJob());
|
||||
getContext().jobQueue().addJob(new TestFailedJob(getContext()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -165,9 +165,9 @@ class TestTunnelJob extends JobImpl {
|
||||
inboundInfo.setLastTested(getContext().clock().now());
|
||||
|
||||
long timeout = getTunnelTestTimeout();
|
||||
TestFailedJob failureJob = new TestFailedJob();
|
||||
TestFailedJob failureJob = new TestFailedJob(getContext());
|
||||
MessageSelector selector = new TestMessageSelector(msg.getMessageId(), info.getTunnelId().getTunnelId(), timeout);
|
||||
SendTunnelMessageJob testJob = new SendTunnelMessageJob(getContext(), msg, info.getTunnelId(), us, _secondaryId, null, new TestSuccessfulJob(timeout), failureJob, selector, timeout, TEST_PRIORITY);
|
||||
SendTunnelMessageJob testJob = new SendTunnelMessageJob(getContext(), msg, info.getTunnelId(), us, _secondaryId, null, new TestSuccessfulJob(getContext(), timeout), failureJob, selector, timeout, TEST_PRIORITY);
|
||||
getContext().jobQueue().addJob(testJob);
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ class TestTunnelJob extends JobImpl {
|
||||
|
||||
_secondaryId = getOutboundTunnel();
|
||||
if (_secondaryId == null) {
|
||||
getContext().jobQueue().addJob(new TestFailedJob());
|
||||
getContext().jobQueue().addJob(new TestFailedJob(getContext()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -191,9 +191,9 @@ class TestTunnelJob extends JobImpl {
|
||||
outboundInfo.setLastTested(getContext().clock().now());
|
||||
|
||||
long timeout = getTunnelTestTimeout();
|
||||
TestFailedJob failureJob = new TestFailedJob();
|
||||
TestFailedJob failureJob = new TestFailedJob(getContext());
|
||||
MessageSelector selector = new TestMessageSelector(msg.getMessageId(), info.getTunnelId().getTunnelId(), timeout);
|
||||
SendTunnelMessageJob j = new SendTunnelMessageJob(getContext(), msg, _secondaryId, info.getThisHop(), info.getTunnelId(), null, new TestSuccessfulJob(timeout), failureJob, selector, timeout, TEST_PRIORITY);
|
||||
SendTunnelMessageJob j = new SendTunnelMessageJob(getContext(), msg, _secondaryId, info.getThisHop(), info.getTunnelId(), null, new TestSuccessfulJob(getContext(), timeout), failureJob, selector, timeout, TEST_PRIORITY);
|
||||
getContext().jobQueue().addJob(j);
|
||||
}
|
||||
|
||||
@ -254,8 +254,8 @@ class TestTunnelJob extends JobImpl {
|
||||
}
|
||||
|
||||
private class TestFailedJob extends JobImpl {
|
||||
public TestFailedJob() {
|
||||
super(TestTunnelJob.this.getContext());
|
||||
public TestFailedJob(RouterContext enclosingContext) {
|
||||
super(enclosingContext);
|
||||
}
|
||||
|
||||
public String getName() { return "Tunnel Test Failed"; }
|
||||
@ -278,8 +278,8 @@ class TestTunnelJob extends JobImpl {
|
||||
private class TestSuccessfulJob extends JobImpl implements ReplyJob {
|
||||
private DeliveryStatusMessage _msg;
|
||||
private long _timeout;
|
||||
public TestSuccessfulJob(long timeout) {
|
||||
super(TestTunnelJob.this.getContext());
|
||||
public TestSuccessfulJob(RouterContext enclosingContext, long timeout) {
|
||||
super(enclosingContext);
|
||||
_msg = null;
|
||||
_timeout = timeout;
|
||||
}
|
||||
|
Reference in New Issue
Block a user