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