This commit is contained in:
zzz
2012-08-29 13:28:03 +00:00
parent fa504ae8a3
commit ab213f45e2
10 changed files with 46 additions and 38 deletions

View File

@ -86,7 +86,7 @@ class ClientConnectionRunner {
private ClientWriterRunner _writer;
private Hash _destHashCache;
/** are we, uh, dead */
private boolean _dead;
private volatile boolean _dead;
/** For outbound traffic. true if i2cp.messageReliability = "none"; @since 0.8.1 */
private boolean _dontSendMSM;
private final AtomicInteger _messageId; // messageId counter
@ -463,10 +463,10 @@ class ClientConnectionRunner {
}
private class Rerequest implements SimpleTimer.TimedEvent {
private LeaseSet _ls;
private long _expirationTime;
private Job _onCreate;
private Job _onFailed;
private final LeaseSet _ls;
private final long _expirationTime;
private final Job _onCreate;
private final Job _onFailed;
public Rerequest(LeaseSet ls, long expirationTime, Job onCreate, Job onFailed) {
_ls = ls;
_expirationTime = expirationTime;

View File

@ -31,8 +31,8 @@ class ClientListenerRunner implements Runnable {
protected ServerSocket _socket;
protected final int _port;
protected final boolean _bindAllInterfaces;
protected boolean _running;
protected boolean _listening;
protected volatile boolean _running;
protected volatile boolean _listening;
public static final String BIND_ALL_INTERFACES = "i2cp.tcp.bindAllInterfaces";

View File

@ -45,7 +45,7 @@ class ClientManager {
private final HashMap<Destination, ClientConnectionRunner> _runners; // Destination --> ClientConnectionRunner
private final Set<ClientConnectionRunner> _pendingRunners; // ClientConnectionRunner for clients w/out a Dest yet
private final RouterContext _ctx;
private boolean _isStarted;
private volatile boolean _isStarted;
/** Disable external interface, allow internal clients only @since 0.8.3 */
private static final String PROP_DISABLE_EXTERNAL = "i2cp.disableInterface";

View File

@ -38,7 +38,7 @@ import net.i2p.util.Log;
public class ClientManagerFacadeImpl extends ClientManagerFacade implements InternalClientManager {
private final Log _log;
private ClientManager _manager;
private RouterContext _context;
private final RouterContext _context;
/** note that this is different than the property the client side uses, i2cp.tcp.port */
public final static String PROP_CLIENT_PORT = "i2cp.port";
public final static int DEFAULT_PORT = 7654;

View File

@ -17,10 +17,10 @@ import net.i2p.util.Log;
* @author zzz modded to use concurrent
*/
class ClientWriterRunner implements Runnable {
private BlockingQueue<I2CPMessage> _messagesToWrite;
private ClientConnectionRunner _runner;
private Log _log;
private long _id;
private final BlockingQueue<I2CPMessage> _messagesToWrite;
private final ClientConnectionRunner _runner;
private final Log _log;
private final long _id;
private static long __id = 0;
public ClientWriterRunner(RouterContext context, ClientConnectionRunner runner) {

View File

@ -24,8 +24,8 @@ import net.i2p.util.Log;
*
*/
class CreateSessionJob extends JobImpl {
private Log _log;
private ClientConnectionRunner _runner;
private final Log _log;
private final ClientConnectionRunner _runner;
public CreateSessionJob(RouterContext context, ClientConnectionRunner runner) {
super(context);

View File

@ -20,12 +20,12 @@ import net.i2p.router.Job;
*/
class LeaseRequestState {
private LeaseSet _grantedLeaseSet;
private LeaseSet _requestedLeaseSet;
private PrivateKey _leaseSetPrivateKey;
private SigningPrivateKey _leaseSetSigningPrivateKey;
private Job _onGranted;
private Job _onFailed;
private long _expiration;
private final LeaseSet _requestedLeaseSet;
//private PrivateKey _leaseSetPrivateKey;
//private SigningPrivateKey _leaseSetSigningPrivateKey;
private final Job _onGranted;
private final Job _onFailed;
private final long _expiration;
private boolean _successful;
public LeaseRequestState(Job onGranted, Job onFailed, long expiration, LeaseSet requested) {
@ -35,26 +35,34 @@ class LeaseRequestState {
_requestedLeaseSet = requested;
}
/** created lease set from client */
/** created lease set from client - FIXME always null */
public LeaseSet getGranted() { return _grantedLeaseSet; }
/** FIXME unused - why? */
public void setGranted(LeaseSet ls) { _grantedLeaseSet = ls; }
/** lease set that is being requested */
public LeaseSet getRequested() { return _requestedLeaseSet; }
public void setRequested(LeaseSet ls) { _requestedLeaseSet = ls; }
//public void setRequested(LeaseSet ls) { _requestedLeaseSet = ls; }
/** the private encryption key received regarding the lease set */
public PrivateKey getPrivateKey() { return _leaseSetPrivateKey; }
public void getPrivateKey(PrivateKey pk) { _leaseSetPrivateKey = pk; }
//public PrivateKey getPrivateKey() { return _leaseSetPrivateKey; }
//public void setPrivateKey(PrivateKey pk) { _leaseSetPrivateKey = pk; }
/** the private signing key received regarding the lease set (for revocation) */
public SigningPrivateKey getSigningPrivateKey() { return _leaseSetSigningPrivateKey; }
public void getSigningPrivateKey(SigningPrivateKey spk) { _leaseSetSigningPrivateKey = spk; }
//public SigningPrivateKey getSigningPrivateKey() { return _leaseSetSigningPrivateKey; }
//public void setSigningPrivateKey(SigningPrivateKey spk) { _leaseSetSigningPrivateKey = spk; }
/** what to do once the lease set is created */
public Job getOnGranted() { return _onGranted; }
public void setOnGranted(Job jb) { _onGranted = jb; }
//public void setOnGranted(Job jb) { _onGranted = jb; }
/** what to do if the lease set create fails / times out */
public Job getOnFailed() { return _onFailed; }
public void setOnFailed(Job jb) { _onFailed = jb; }
//public void setOnFailed(Job jb) { _onFailed = jb; }
/** when the request for the lease set expires */
public long getExpiration() { return _expiration; }
/** whether the request was successful in the time allotted */
public boolean getIsSuccessful() { return _successful; }
public void setIsSuccessful(boolean is) { _successful = is; }

View File

@ -16,8 +16,8 @@ import net.i2p.router.RouterContext;
* Look up the lease of a hash, to convert it to a Destination for the client
*/
class LookupDestJob extends JobImpl {
private ClientConnectionRunner _runner;
private Hash _hash;
private final ClientConnectionRunner _runner;
private final Hash _hash;
public LookupDestJob(RouterContext context, ClientConnectionRunner runner, Hash h) {
super(context);

View File

@ -22,9 +22,9 @@ import net.i2p.util.Log;
*
*/
class MessageReceivedJob extends JobImpl {
private Log _log;
private ClientConnectionRunner _runner;
private Payload _payload;
private final Log _log;
private final ClientConnectionRunner _runner;
private final Payload _payload;
public MessageReceivedJob(RouterContext ctx, ClientConnectionRunner runner, Destination toDest, Destination fromDest, Payload payload) {
super(ctx);
_log = ctx.logManager().getLog(MessageReceivedJob.class);

View File

@ -21,10 +21,10 @@ import net.i2p.util.Log;
*
*/
class ReportAbuseJob extends JobImpl {
private Log _log;
private ClientConnectionRunner _runner;
private String _reason;
private int _severity;
private final Log _log;
private final ClientConnectionRunner _runner;
private final String _reason;
private final int _severity;
public ReportAbuseJob(RouterContext context, ClientConnectionRunner runner, String reason, int severity) {
super(context);
_log = context.logManager().getLog(ReportAbuseJob.class);