should compile on 1.5 again now
This commit is contained in:
@ -131,7 +131,6 @@ public class ATalk implements I2PSessionListener, Runnable {
|
|||||||
* application is complete.
|
* application is complete.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
connect();
|
connect();
|
||||||
@ -242,7 +241,6 @@ public class ATalk implements I2PSessionListener, Runnable {
|
|||||||
* message to the user.
|
* message to the user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void messageAvailable(I2PSession session, int msgId, long size) {
|
public void messageAvailable(I2PSession session, int msgId, long size) {
|
||||||
_log.debug("Message available: id = " + msgId + " size = " + size);
|
_log.debug("Message available: id = " + msgId + " size = " + size);
|
||||||
try {
|
try {
|
||||||
@ -353,19 +351,16 @@ public class ATalk implements I2PSessionListener, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
|
||||||
@Override
|
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
_log.debug("Disconnected");
|
_log.debug("Disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
|
||||||
@Override
|
|
||||||
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
||||||
_log.debug("Error occurred: " + message, error);
|
_log.debug("Error occurred: " + message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
|
||||||
@Override
|
|
||||||
public void reportAbuse(I2PSession session, int severity) {
|
public void reportAbuse(I2PSession session, int severity) {
|
||||||
_log.debug("Abuse reported of severity " + severity);
|
_log.debug("Abuse reported of severity " + severity);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ class DisconnectMessageHandler extends HandlerImpl {
|
|||||||
super(context, DisconnectMessage.MESSAGE_TYPE);
|
super(context, DisconnectMessage.MESSAGE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
_log.debug("Handle message " + message);
|
||||||
session.destroySession(false);
|
session.destroySession(false);
|
||||||
|
@ -28,7 +28,6 @@ abstract class HandlerImpl implements I2CPMessageHandler {
|
|||||||
_log = new Log(getClass());
|
_log = new Log(getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ class I2PClientImpl implements I2PClient {
|
|||||||
/**
|
/**
|
||||||
* Create the destination with a null payload
|
* Create the destination with a null payload
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Destination createDestination(OutputStream destKeyStream) throws I2PException, IOException {
|
public Destination createDestination(OutputStream destKeyStream) throws I2PException, IOException {
|
||||||
Certificate cert = new Certificate();
|
Certificate cert = new Certificate();
|
||||||
cert.setCertificateType(Certificate.CERTIFICATE_TYPE_NULL);
|
cert.setCertificateType(Certificate.CERTIFICATE_TYPE_NULL);
|
||||||
@ -46,7 +45,6 @@ class I2PClientImpl implements I2PClient {
|
|||||||
* the PrivateKey and SigningPrivateKey to the destKeyStream
|
* the PrivateKey and SigningPrivateKey to the destKeyStream
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Destination createDestination(OutputStream destKeyStream, Certificate cert) throws I2PException, IOException {
|
public Destination createDestination(OutputStream destKeyStream, Certificate cert) throws I2PException, IOException {
|
||||||
Destination d = new Destination();
|
Destination d = new Destination();
|
||||||
d.setCertificate(cert);
|
d.setCertificate(cert);
|
||||||
@ -71,7 +69,6 @@ class I2PClientImpl implements I2PClient {
|
|||||||
* Create a new session (though do not connect it yet)
|
* Create a new session (though do not connect it yet)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException {
|
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException {
|
||||||
return createSession(I2PAppContext.getGlobalContext(), destKeyStream, options);
|
return createSession(I2PAppContext.getGlobalContext(), destKeyStream, options);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
* @throws I2PSessionException if there is a configuration error or the router is
|
* @throws I2PSessionException if there is a configuration error or the router is
|
||||||
* not reachable
|
* not reachable
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void connect() throws I2PSessionException {
|
public void connect() throws I2PSessionException {
|
||||||
_closed = false;
|
_closed = false;
|
||||||
_availabilityNotifier.stopNotifying();
|
_availabilityNotifier.stopNotifying();
|
||||||
@ -304,7 +303,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
* notified the user that its available.
|
* notified the user that its available.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public byte[] receiveMessage(int msgId) throws I2PSessionException {
|
public byte[] receiveMessage(int msgId) throws I2PSessionException {
|
||||||
int remaining = 0;
|
int remaining = 0;
|
||||||
MessagePayloadMessage msg = null;
|
MessagePayloadMessage msg = null;
|
||||||
@ -323,7 +321,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
/**
|
/**
|
||||||
* Report abuse with regards to the given messageId
|
* Report abuse with regards to the given messageId
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void reportAbuse(int msgId, int severity) throws I2PSessionException {
|
public void reportAbuse(int msgId, int severity) throws I2PSessionException {
|
||||||
if (isClosed()) throw new I2PSessionException(getPrefix() + "Already closed");
|
if (isClosed()) throw new I2PSessionException(getPrefix() + "Already closed");
|
||||||
_producer.reportAbuse(this, msgId, severity);
|
_producer.reportAbuse(this, msgId, severity);
|
||||||
@ -335,10 +332,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
* delivered successfully. make this wait for at least ACCEPTED
|
* delivered successfully. make this wait for at least ACCEPTED
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public abstract boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException;
|
public abstract boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException;
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed,
|
public abstract boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed,
|
||||||
Set tagsSent) throws I2PSessionException;
|
Set tagsSent) throws I2PSessionException;
|
||||||
|
|
||||||
@ -380,7 +375,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
private Long _msgId;
|
private Long _msgId;
|
||||||
public VerifyUsage(Long id) { _msgId = id; }
|
public VerifyUsage(Long id) { _msgId = id; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void timeReached() {
|
public void timeReached() {
|
||||||
MessagePayloadMessage removed = null;
|
MessagePayloadMessage removed = null;
|
||||||
int remaining = 0;
|
int remaining = 0;
|
||||||
@ -419,7 +413,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
AvailabilityNotifier.this.notifyAll();
|
AvailabilityNotifier.this.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
_alive = true;
|
_alive = true;
|
||||||
while (_alive) {
|
while (_alive) {
|
||||||
@ -461,7 +454,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
* Recieve notification of some I2CP message and handle it if possible
|
* Recieve notification of some I2CP message and handle it if possible
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void messageReceived(I2CPMessageReader reader, I2CPMessage message) {
|
public void messageReceived(I2CPMessageReader reader, I2CPMessage message) {
|
||||||
I2CPMessageHandler handler = _handlerMap.getHandler(message.getType());
|
I2CPMessageHandler handler = _handlerMap.getHandler(message.getType());
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
@ -480,7 +472,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
* Recieve notifiation of an error reading the I2CP stream
|
* Recieve notifiation of an error reading the I2CP stream
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void readError(I2CPMessageReader reader, Exception error) {
|
public void readError(I2CPMessageReader reader, Exception error) {
|
||||||
propogateError("There was an error reading data", error);
|
propogateError("There was an error reading data", error);
|
||||||
disconnect();
|
disconnect();
|
||||||
@ -489,19 +480,16 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
/**
|
/**
|
||||||
* Retrieve the destination of the session
|
* Retrieve the destination of the session
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Destination getMyDestination() { return _myDestination; }
|
public Destination getMyDestination() { return _myDestination; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the decryption PrivateKey
|
* Retrieve the decryption PrivateKey
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public PrivateKey getDecryptionKey() { return _privateKey; }
|
public PrivateKey getDecryptionKey() { return _privateKey; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the signing SigningPrivateKey
|
* Retrieve the signing SigningPrivateKey
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public SigningPrivateKey getPrivateKey() { return _signingPrivateKey; }
|
public SigningPrivateKey getPrivateKey() { return _signingPrivateKey; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -521,11 +509,9 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
void setSessionId(SessionId id) { _sessionId = id; }
|
void setSessionId(SessionId id) { _sessionId = id; }
|
||||||
|
|
||||||
/** configure the listener */
|
/** configure the listener */
|
||||||
@Override
|
|
||||||
public void setSessionListener(I2PSessionListener lsnr) { _sessionListener = lsnr; }
|
public void setSessionListener(I2PSessionListener lsnr) { _sessionListener = lsnr; }
|
||||||
|
|
||||||
/** has the session been closed (or not yet connected)? */
|
/** has the session been closed (or not yet connected)? */
|
||||||
@Override
|
|
||||||
public boolean isClosed() { return _closed; }
|
public boolean isClosed() { return _closed; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -575,7 +561,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
/**
|
/**
|
||||||
* Tear down the session, and do NOT reconnect
|
* Tear down the session, and do NOT reconnect
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void destroySession() {
|
public void destroySession() {
|
||||||
destroySession(true);
|
destroySession(true);
|
||||||
}
|
}
|
||||||
@ -623,7 +608,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
/**
|
/**
|
||||||
* Recieve notification that the I2CP connection was disconnected
|
* Recieve notification that the I2CP connection was disconnected
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void disconnected(I2CPMessageReader reader) {
|
public void disconnected(I2CPMessageReader reader) {
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Disconnected", new Exception("Disconnected"));
|
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Disconnected", new Exception("Disconnected"));
|
||||||
disconnect();
|
disconnect();
|
||||||
|
@ -80,7 +80,6 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
|||||||
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException {
|
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException {
|
||||||
return sendMessage(dest, payload, 0, payload.length);
|
return sendMessage(dest, payload, 0, payload.length);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size) throws I2PSessionException {
|
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size) throws I2PSessionException {
|
||||||
return sendMessage(dest, payload, offset, size, new SessionKey(), new HashSet(64));
|
return sendMessage(dest, payload, offset, size, new SessionKey(), new HashSet(64));
|
||||||
}
|
}
|
||||||
@ -89,7 +88,6 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
|||||||
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set tagsSent) throws I2PSessionException {
|
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set tagsSent) throws I2PSessionException {
|
||||||
return sendMessage(dest, payload, 0, payload.length, keyUsed, tagsSent);
|
return sendMessage(dest, payload, 0, payload.length, keyUsed, tagsSent);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent)
|
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent)
|
||||||
throws I2PSessionException {
|
throws I2PSessionException {
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("sending message");
|
if (_log.shouldLog(Log.DEBUG)) _log.debug("sending message");
|
||||||
|
@ -29,7 +29,6 @@ class MessagePayloadMessageHandler extends HandlerImpl {
|
|||||||
super(context, MessagePayloadMessage.MESSAGE_TYPE);
|
super(context, MessagePayloadMessage.MESSAGE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Handle message " + message);
|
_log.debug("Handle message " + message);
|
||||||
|
@ -26,7 +26,6 @@ class MessageStatusMessageHandler extends HandlerImpl {
|
|||||||
super(context, MessageStatusMessage.MESSAGE_TYPE);
|
super(context, MessageStatusMessage.MESSAGE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
boolean skipStatus = true;
|
boolean skipStatus = true;
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
@ -40,7 +40,6 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
|
|||||||
_existingLeaseSets = new HashMap(32);
|
_existingLeaseSets = new HashMap(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Handle message " + message);
|
_log.debug("Handle message " + message);
|
||||||
|
@ -24,7 +24,6 @@ class SessionStatusMessageHandler extends HandlerImpl {
|
|||||||
super(context, SessionStatusMessage.MESSAGE_TYPE);
|
super(context, SessionStatusMessage.MESSAGE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
_log.debug("Handle message " + message);
|
||||||
SessionStatusMessage msg = (SessionStatusMessage) message;
|
SessionStatusMessage msg = (SessionStatusMessage) message;
|
||||||
|
@ -24,7 +24,6 @@ class SetDateMessageHandler extends HandlerImpl {
|
|||||||
super(ctx, SetDateMessage.MESSAGE_TYPE);
|
super(ctx, SetDateMessage.MESSAGE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
_log.debug("Handle message " + message);
|
||||||
SetDateMessage msg = (SetDateMessage) message;
|
SetDateMessage msg = (SetDateMessage) message;
|
||||||
|
@ -42,7 +42,6 @@ public class Address extends DataStructureImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException,
|
public void readBytes(InputStream in) throws DataFormatException,
|
||||||
IOException {
|
IOException {
|
||||||
_hostname = DataHelper.readString(in);
|
_hostname = DataHelper.readString(in);
|
||||||
@ -50,7 +49,6 @@ public class Address extends DataStructureImpl {
|
|||||||
_destination.readBytes(in);
|
_destination.readBytes(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException,
|
public void writeBytes(OutputStream out) throws DataFormatException,
|
||||||
IOException {
|
IOException {
|
||||||
if ((_hostname == null) || (_destination == null))
|
if ((_hostname == null) || (_destination == null))
|
||||||
|
@ -74,7 +74,6 @@ public class ByteArray implements Serializable, Comparable {
|
|||||||
return (llen == rlen) && DataHelper.eq(lhs, loff, rhs, roff, llen);
|
return (llen == rlen) && DataHelper.eq(lhs, loff, rhs, roff, llen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int compareTo(Object obj) {
|
public final int compareTo(Object obj) {
|
||||||
if (obj.getClass() != getClass()) throw new ClassCastException("invalid object: " + obj);
|
if (obj.getClass() != getClass()) throw new ClassCastException("invalid object: " + obj);
|
||||||
return DataHelper.compareTo(_data, ((ByteArray)obj).getData());
|
return DataHelper.compareTo(_data, ((ByteArray)obj).getData());
|
||||||
|
@ -67,7 +67,6 @@ public class Certificate extends DataStructureImpl {
|
|||||||
_payload = payload;
|
_payload = payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_type = (int) DataHelper.readLong(in, 1);
|
_type = (int) DataHelper.readLong(in, 1);
|
||||||
int length = (int) DataHelper.readLong(in, 2);
|
int length = (int) DataHelper.readLong(in, 2);
|
||||||
@ -80,7 +79,6 @@ public class Certificate extends DataStructureImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_type < 0) throw new DataFormatException("Invalid certificate type: " + _type);
|
if (_type < 0) throw new DataFormatException("Invalid certificate type: " + _type);
|
||||||
//if ((_type != 0) && (_payload == null)) throw new DataFormatException("Payload is required for non null type");
|
//if ((_type != 0) && (_payload == null)) throw new DataFormatException("Payload is required for non null type");
|
||||||
|
@ -25,7 +25,6 @@ import net.i2p.util.Log;
|
|||||||
public abstract class DataStructureImpl implements DataStructure {
|
public abstract class DataStructureImpl implements DataStructure {
|
||||||
private final static Log _log = new Log(DataStructureImpl.class);
|
private final static Log _log = new Log(DataStructureImpl.class);
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toBase64() {
|
public String toBase64() {
|
||||||
byte data[] = toByteArray();
|
byte data[] = toByteArray();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
@ -33,19 +32,16 @@ public abstract class DataStructureImpl implements DataStructure {
|
|||||||
|
|
||||||
return Base64.encode(data);
|
return Base64.encode(data);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void fromBase64(String data) throws DataFormatException {
|
public void fromBase64(String data) throws DataFormatException {
|
||||||
if (data == null) throw new DataFormatException("Null data passed in");
|
if (data == null) throw new DataFormatException("Null data passed in");
|
||||||
byte bytes[] = Base64.decode(data);
|
byte bytes[] = Base64.decode(data);
|
||||||
fromByteArray(bytes);
|
fromByteArray(bytes);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public Hash calculateHash() {
|
public Hash calculateHash() {
|
||||||
byte data[] = toByteArray();
|
byte data[] = toByteArray();
|
||||||
if (data != null) return SHA256Generator.getInstance().calculateHash(data);
|
if (data != null) return SHA256Generator.getInstance().calculateHash(data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public byte[] toByteArray() {
|
public byte[] toByteArray() {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
|
||||||
@ -59,7 +55,6 @@ public abstract class DataStructureImpl implements DataStructure {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void fromByteArray(byte data[]) throws DataFormatException {
|
public void fromByteArray(byte data[]) throws DataFormatException {
|
||||||
if (data == null) throw new DataFormatException("Null data passed in");
|
if (data == null) throw new DataFormatException("Null data passed in");
|
||||||
try {
|
try {
|
||||||
|
@ -72,7 +72,6 @@ public class Destination extends DataStructureImpl {
|
|||||||
__calculatedHash = null;
|
__calculatedHash = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_publicKey = new PublicKey();
|
_publicKey = new PublicKey();
|
||||||
_publicKey.readBytes(in);
|
_publicKey.readBytes(in);
|
||||||
@ -83,7 +82,6 @@ public class Destination extends DataStructureImpl {
|
|||||||
__calculatedHash = null;
|
__calculatedHash = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||||
throw new DataFormatException("Not enough data to format the destination");
|
throw new DataFormatException("Not enough data to format the destination");
|
||||||
|
@ -127,7 +127,6 @@ public class Hash extends DataStructureImpl {
|
|||||||
_xorCache = null;
|
_xorCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[HASH_LENGTH];
|
_data = new byte[HASH_LENGTH];
|
||||||
_stringified = null;
|
_stringified = null;
|
||||||
@ -136,7 +135,6 @@ public class Hash extends DataStructureImpl {
|
|||||||
if (read != HASH_LENGTH) throw new DataFormatException("Not enough bytes to read the hash");
|
if (read != HASH_LENGTH) throw new DataFormatException("Not enough bytes to read the hash");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the hash to write out");
|
if (_data == null) throw new DataFormatException("No data in the hash to write out");
|
||||||
if (_data.length != HASH_LENGTH) throw new DataFormatException("Invalid size of data in the private key");
|
if (_data.length != HASH_LENGTH) throw new DataFormatException("Invalid size of data in the private key");
|
||||||
|
@ -112,7 +112,6 @@ public class Lease extends DataStructureImpl {
|
|||||||
return _end.getTime() < Clock.getInstance().now() - fudgeFactor;
|
return _end.getTime() < Clock.getInstance().now() - fudgeFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_gateway = new Hash();
|
_gateway = new Hash();
|
||||||
_gateway.readBytes(in);
|
_gateway.readBytes(in);
|
||||||
@ -121,7 +120,6 @@ public class Lease extends DataStructureImpl {
|
|||||||
_end = DataHelper.readDate(in);
|
_end = DataHelper.readDate(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_gateway == null) || (_tunnelId == null))
|
if ((_gateway == null) || (_tunnelId == null))
|
||||||
throw new DataFormatException("Not enough data to write out a Lease");
|
throw new DataFormatException("Not enough data to write out a Lease");
|
||||||
|
@ -253,7 +253,6 @@ public class LeaseSet extends DataStructureImpl {
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_destination = new Destination();
|
_destination = new Destination();
|
||||||
_destination.readBytes(in);
|
_destination.readBytes(in);
|
||||||
@ -275,7 +274,6 @@ public class LeaseSet extends DataStructureImpl {
|
|||||||
_signature.readBytes(in);
|
_signature.readBytes(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_destination == null) || (_encryptionKey == null) || (_signingKey == null) || (_leases == null)
|
if ((_destination == null) || (_encryptionKey == null) || (_signingKey == null) || (_leases == null)
|
||||||
|| (_signature == null)) throw new DataFormatException("Not enough data to write out a LeaseSet");
|
|| (_signature == null)) throw new DataFormatException("Not enough data to write out a LeaseSet");
|
||||||
|
@ -67,7 +67,6 @@ public class Payload extends DataStructureImpl {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
int size = (int) DataHelper.readLong(in, 4);
|
int size = (int) DataHelper.readLong(in, 4);
|
||||||
if (size < 0) throw new DataFormatException("payload size out of range (" + size + ")");
|
if (size < 0) throw new DataFormatException("payload size out of range (" + size + ")");
|
||||||
@ -78,7 +77,6 @@ public class Payload extends DataStructureImpl {
|
|||||||
_log.debug("read payload: " + read + " bytes");
|
_log.debug("read payload: " + read + " bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
||||||
DataHelper.writeLong(out, 4, _encryptedData.length);
|
DataHelper.writeLong(out, 4, _encryptedData.length);
|
||||||
|
@ -51,14 +51,12 @@ public class PrivateKey extends DataStructureImpl {
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[KEYSIZE_BYTES];
|
_data = new byte[KEYSIZE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||||
if (_data.length != KEYSIZE_BYTES)
|
if (_data.length != KEYSIZE_BYTES)
|
||||||
|
@ -54,14 +54,12 @@ public class PublicKey extends DataStructureImpl {
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[KEYSIZE_BYTES];
|
_data = new byte[KEYSIZE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||||
|
@ -105,7 +105,6 @@ public class RouterAddress extends DataStructureImpl {
|
|||||||
_options = options;
|
_options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_cost = (int) DataHelper.readLong(in, 1);
|
_cost = (int) DataHelper.readLong(in, 1);
|
||||||
_expiration = DataHelper.readDate(in);
|
_expiration = DataHelper.readDate(in);
|
||||||
@ -113,7 +112,6 @@ public class RouterAddress extends DataStructureImpl {
|
|||||||
_options = DataHelper.readProperties(in);
|
_options = DataHelper.readProperties(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_cost < 0) || (_transportStyle == null) || (_options == null))
|
if ((_cost < 0) || (_transportStyle == null) || (_options == null))
|
||||||
throw new DataFormatException("Not enough data to write a router address");
|
throw new DataFormatException("Not enough data to write a router address");
|
||||||
|
@ -74,7 +74,6 @@ public class RouterIdentity extends DataStructureImpl {
|
|||||||
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_publicKey = new PublicKey();
|
_publicKey = new PublicKey();
|
||||||
_publicKey.readBytes(in);
|
_publicKey.readBytes(in);
|
||||||
@ -85,7 +84,6 @@ public class RouterIdentity extends DataStructureImpl {
|
|||||||
__calculatedHash = null;
|
__calculatedHash = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||||
throw new DataFormatException("Not enough data to format the router identity");
|
throw new DataFormatException("Not enough data to format the router identity");
|
||||||
|
@ -487,7 +487,6 @@ public class RouterInfo extends DataStructureImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void readBytes(InputStream in) throws DataFormatException, IOException {
|
public synchronized void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_identity = new RouterIdentity();
|
_identity = new RouterIdentity();
|
||||||
_identity.readBytes(in);
|
_identity.readBytes(in);
|
||||||
@ -517,7 +516,6 @@ public class RouterInfo extends DataStructureImpl {
|
|||||||
//_log.debug("Read routerInfo: " + toString());
|
//_log.debug("Read routerInfo: " + toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public synchronized void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_identity == null) throw new DataFormatException("Missing identity");
|
if (_identity == null) throw new DataFormatException("Missing identity");
|
||||||
if (_published < 0) throw new DataFormatException("Invalid published date: " + _published);
|
if (_published < 0) throw new DataFormatException("Invalid published date: " + _published);
|
||||||
|
@ -58,14 +58,12 @@ public class SessionKey extends DataStructureImpl {
|
|||||||
public Object getPreparedKey() { return _preparedKey; }
|
public Object getPreparedKey() { return _preparedKey; }
|
||||||
public void setPreparedKey(Object obj) { _preparedKey = obj; }
|
public void setPreparedKey(Object obj) { _preparedKey = obj; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[KEYSIZE_BYTES];
|
_data = new byte[KEYSIZE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the session key");
|
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the session key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the session key to write out");
|
if (_data == null) throw new DataFormatException("No data in the session key to write out");
|
||||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||||
|
@ -44,14 +44,12 @@ public class Signature extends DataStructureImpl {
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[SIGNATURE_BYTES];
|
_data = new byte[SIGNATURE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != SIGNATURE_BYTES) throw new DataFormatException("Not enough bytes to read the signature");
|
if (read != SIGNATURE_BYTES) throw new DataFormatException("Not enough bytes to read the signature");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the signature to write out");
|
if (_data == null) throw new DataFormatException("No data in the signature to write out");
|
||||||
if (_data.length != SIGNATURE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
if (_data.length != SIGNATURE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||||
|
@ -50,14 +50,12 @@ public class SigningPrivateKey extends DataStructureImpl {
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[KEYSIZE_BYTES];
|
_data = new byte[KEYSIZE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||||
|
@ -49,14 +49,12 @@ public class SigningPublicKey extends DataStructureImpl {
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_data = new byte[KEYSIZE_BYTES];
|
_data = new byte[KEYSIZE_BYTES];
|
||||||
int read = read(in, _data);
|
int read = read(in, _data);
|
||||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||||
|
@ -68,12 +68,10 @@ public class TunnelId extends DataStructureImpl {
|
|||||||
public int getType() { return _type; }
|
public int getType() { return _type; }
|
||||||
public void setType(int type) { _type = type; }
|
public void setType(int type) { _type = type; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_tunnelId = DataHelper.readLong(in, 4);
|
_tunnelId = DataHelper.readLong(in, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_tunnelId < 0) throw new DataFormatException("Invalid tunnel ID: " + _tunnelId);
|
if (_tunnelId < 0) throw new DataFormatException("Invalid tunnel ID: " + _tunnelId);
|
||||||
DataHelper.writeLong(out, 4, _tunnelId);
|
DataHelper.writeLong(out, 4, _tunnelId);
|
||||||
|
@ -40,12 +40,10 @@ public class AbuseReason extends DataStructureImpl {
|
|||||||
_reason = reason;
|
_reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_reason = DataHelper.readString(in);
|
_reason = DataHelper.readString(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_reason == null) throw new DataFormatException("Invalid abuse reason");
|
if (_reason == null) throw new DataFormatException("Invalid abuse reason");
|
||||||
DataHelper.writeString(out, _reason);
|
DataHelper.writeString(out, _reason);
|
||||||
|
@ -41,12 +41,10 @@ public class AbuseSeverity extends DataStructureImpl {
|
|||||||
_severityId = id;
|
_severityId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_severityId = (int) DataHelper.readLong(in, 1);
|
_severityId = (int) DataHelper.readLong(in, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_severityId < 0) throw new DataFormatException("Invalid abuse severity: " + _severityId);
|
if (_severityId < 0) throw new DataFormatException("Invalid abuse severity: " + _severityId);
|
||||||
DataHelper.writeLong(out, 1, _severityId);
|
DataHelper.writeLong(out, 1, _severityId);
|
||||||
|
@ -109,7 +109,6 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
|||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
|||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ public class GetDateMessage extends I2CPMessageImpl {
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void readMessage(InputStream in) throws I2CPMessageException, IOException {
|
public void readMessage(InputStream in) throws I2CPMessageException, IOException {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
try {
|
try {
|
||||||
@ -58,7 +57,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
* @param length number of bytes in the message payload
|
* @param length number of bytes in the message payload
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
||||||
if (type != getType())
|
if (type != getType())
|
||||||
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
|
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
|
||||||
@ -105,7 +103,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||||
byte[] data = doWriteMessage();
|
byte[] data = doWriteMessage();
|
||||||
try {
|
try {
|
||||||
@ -117,7 +114,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
out.write(data);
|
out.write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
try {
|
try {
|
||||||
readMessage(in);
|
readMessage(in);
|
||||||
@ -126,7 +122,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
try {
|
try {
|
||||||
writeMessage(out);
|
writeMessage(out);
|
||||||
|
@ -144,7 +144,6 @@ public class I2CPMessageReader {
|
|||||||
_stream = null;
|
_stream = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
while (_stayAlive) {
|
while (_stayAlive) {
|
||||||
while (_doRun) {
|
while (_doRun) {
|
||||||
|
@ -43,12 +43,10 @@ public class MessageId extends DataStructureImpl {
|
|||||||
_messageId = id;
|
_messageId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_messageId = DataHelper.readLong(in, 4);
|
_messageId = DataHelper.readLong(in, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_messageId < 0) throw new DataFormatException("Invalid message ID: " + _messageId);
|
if (_messageId < 0) throw new DataFormatException("Invalid message ID: " + _messageId);
|
||||||
DataHelper.writeLong(out, 4, _messageId);
|
DataHelper.writeLong(out, 4, _messageId);
|
||||||
|
@ -106,7 +106,6 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,6 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
|||||||
throw new UnsupportedOperationException("This shouldn't be called... use writeMessage(out)");
|
throw new UnsupportedOperationException("This shouldn't be called... use writeMessage(out)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,6 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,6 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
|||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,6 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,6 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,6 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
return out.toByteArray();
|
return out.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream rawConfig) throws DataFormatException, IOException {
|
public void readBytes(InputStream rawConfig) throws DataFormatException, IOException {
|
||||||
_destination = new Destination();
|
_destination = new Destination();
|
||||||
_destination.readBytes(rawConfig);
|
_destination.readBytes(rawConfig);
|
||||||
@ -195,7 +194,6 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
_signature.readBytes(rawConfig);
|
_signature.readBytes(rawConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if ((_destination == null) || (_options == null) || (_signature == null) || (_creationDate == null))
|
if ((_destination == null) || (_options == null) || (_signature == null) || (_creationDate == null))
|
||||||
throw new DataFormatException("Not enough data to create the session config");
|
throw new DataFormatException("Not enough data to create the session config");
|
||||||
|
@ -40,12 +40,10 @@ public class SessionId extends DataStructureImpl {
|
|||||||
_sessionId = id;
|
_sessionId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||||
_sessionId = (int) DataHelper.readLong(in, 2);
|
_sessionId = (int) DataHelper.readLong(in, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_sessionId < 0) throw new DataFormatException("Invalid session ID: " + _sessionId);
|
if (_sessionId < 0) throw new DataFormatException("Invalid session ID: " + _sessionId);
|
||||||
DataHelper.writeLong(out, 2, _sessionId);
|
DataHelper.writeLong(out, 2, _sessionId);
|
||||||
|
@ -79,8 +79,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
|||||||
}
|
}
|
||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,7 @@ public class SetDateMessage extends I2CPMessageImpl {
|
|||||||
}
|
}
|
||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return MESSAGE_TYPE;
|
return MESSAGE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ public class BufferedStatLog implements StatLog {
|
|||||||
writer.start();
|
writer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addData(String scope, String stat, long value, long duration) {
|
public void addData(String scope, String stat, long value, long duration) {
|
||||||
if (DISABLE_LOGGING) return;
|
if (DISABLE_LOGGING) return;
|
||||||
if (!shouldLog(stat)) return;
|
if (!shouldLog(stat)) return;
|
||||||
@ -123,7 +122,6 @@ public class BufferedStatLog implements StatLog {
|
|||||||
|
|
||||||
private class StatLogWriter implements Runnable {
|
private class StatLogWriter implements Runnable {
|
||||||
private SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
|
private SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
int writeStart = -1;
|
int writeStart = -1;
|
||||||
int writeEnd = -1;
|
int writeEnd = -1;
|
||||||
|
@ -110,7 +110,6 @@ public class Timestamper implements Runnable {
|
|||||||
} catch (InterruptedException ie) {}
|
} catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
|
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
|
||||||
_log = _context.logManager().getLog(Timestamper.class);
|
_log = _context.logManager().getLog(Timestamper.class);
|
||||||
|
@ -108,7 +108,6 @@ public final class ByteCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class Cleanup implements SimpleTimer.TimedEvent {
|
private class Cleanup implements SimpleTimer.TimedEvent {
|
||||||
@Override
|
|
||||||
public void timeReached() {
|
public void timeReached() {
|
||||||
if (System.currentTimeMillis() - _lastOverflow > EXPIRE_PERIOD) {
|
if (System.currentTimeMillis() - _lastOverflow > EXPIRE_PERIOD) {
|
||||||
// we haven't exceeded the cache size in a few minutes, so lets
|
// we haven't exceeded the cache size in a few minutes, so lets
|
||||||
|
@ -110,7 +110,7 @@ public class Clock implements Timestamper.UpdateListener {
|
|||||||
|
|
||||||
public boolean getUpdatedSuccessfully() { return _alreadyChanged; }
|
public boolean getUpdatedSuccessfully() { return _alreadyChanged; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNow(long realTime) {
|
public void setNow(long realTime) {
|
||||||
long diff = realTime - System.currentTimeMillis();
|
long diff = realTime - System.currentTimeMillis();
|
||||||
setOffset(diff);
|
setOffset(diff);
|
||||||
|
@ -206,7 +206,6 @@ public class DecayingBloomFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DecayEvent implements SimpleTimer.TimedEvent {
|
private class DecayEvent implements SimpleTimer.TimedEvent {
|
||||||
@Override
|
|
||||||
public void timeReached() {
|
public void timeReached() {
|
||||||
if (_keepDecaying) {
|
if (_keepDecaying) {
|
||||||
decay();
|
decay();
|
||||||
|
@ -262,7 +262,6 @@ public class EepGet {
|
|||||||
_startedOn = _lastComplete;
|
_startedOn = _lastComplete;
|
||||||
_firstTime = true;
|
_firstTime = true;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
||||||
if (_firstTime) {
|
if (_firstTime) {
|
||||||
if (alreadyTransferred > 0) {
|
if (alreadyTransferred > 0) {
|
||||||
@ -319,7 +318,6 @@ public class EepGet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||||
long transferred;
|
long transferred;
|
||||||
if (_firstTime)
|
if (_firstTime)
|
||||||
@ -358,7 +356,6 @@ public class EepGet {
|
|||||||
System.out.println(buf.toString());
|
System.out.println(buf.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("** " + new Date());
|
System.out.println("** " + new Date());
|
||||||
@ -369,7 +366,6 @@ public class EepGet {
|
|||||||
_previousWritten += _written;
|
_previousWritten += _written;
|
||||||
_written = 0;
|
_written = 0;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||||
System.out.println("== " + new Date());
|
System.out.println("== " + new Date());
|
||||||
System.out.println("== Transfer of " + url + " failed after " + currentAttempt + " attempts");
|
System.out.println("== Transfer of " + url + " failed after " + currentAttempt + " attempts");
|
||||||
@ -386,9 +382,7 @@ public class EepGet {
|
|||||||
buf.append("KBps");
|
buf.append("KBps");
|
||||||
System.out.println(buf.toString());
|
System.out.println(buf.toString());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void attempting(String url) {}
|
public void attempting(String url) {}
|
||||||
@Override
|
|
||||||
public void headerReceived(String url, int currentAttempt, String key, String val) {}
|
public void headerReceived(String url, int currentAttempt, String key, String val) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +418,6 @@ public class EepGet {
|
|||||||
timeout = new SocketTimeout(_fetchHeaderTimeout);
|
timeout = new SocketTimeout(_fetchHeaderTimeout);
|
||||||
final SocketTimeout stimeout = timeout; // ugly
|
final SocketTimeout stimeout = timeout; // ugly
|
||||||
timeout.setTimeoutCommand(new Runnable() {
|
timeout.setTimeoutCommand(new Runnable() {
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("timeout reached on " + _url + ": " + stimeout);
|
_log.debug("timeout reached on " + _url + ": " + stimeout);
|
||||||
|
@ -30,7 +30,6 @@ public class EepGetScheduler implements EepGet.StatusListener {
|
|||||||
|
|
||||||
public void fetch() {
|
public void fetch() {
|
||||||
I2PThread t = new I2PThread(new Runnable() {
|
I2PThread t = new I2PThread(new Runnable() {
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
fetchNext();
|
fetchNext();
|
||||||
}
|
}
|
||||||
@ -67,30 +66,24 @@ public class EepGetScheduler implements EepGet.StatusListener {
|
|||||||
get.fetch();
|
get.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||||
_listener.attemptFailed(url, bytesTransferred, bytesRemaining, currentAttempt, numRetries, cause);
|
_listener.attemptFailed(url, bytesTransferred, bytesRemaining, currentAttempt, numRetries, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
||||||
_listener.bytesTransferred(alreadyTransferred, currentWrite, bytesTransferred, bytesRemaining, url);
|
_listener.bytesTransferred(alreadyTransferred, currentWrite, bytesTransferred, bytesRemaining, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||||
_listener.transferComplete(alreadyTransferred, bytesTransferred, bytesRemaining, url, outputFile, notModified);
|
_listener.transferComplete(alreadyTransferred, bytesTransferred, bytesRemaining, url, outputFile, notModified);
|
||||||
fetchNext();
|
fetchNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||||
_listener.transferFailed(url, bytesTransferred, bytesRemaining, currentAttempt);
|
_listener.transferFailed(url, bytesTransferred, bytesRemaining, currentAttempt);
|
||||||
fetchNext();
|
fetchNext();
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void attempting(String url) { _listener.attempting(url); }
|
public void attempting(String url) { _listener.attempting(url); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void headerReceived(String url, int attemptNum, String key, String val) {}
|
public void headerReceived(String url, int attemptNum, String key, String val) {}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ public class EepPost {
|
|||||||
_fields = fields;
|
_fields = fields;
|
||||||
_onCompletion = onCompletion;
|
_onCompletion = onCompletion;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Running the post task");
|
if (_log.shouldLog(Log.DEBUG)) _log.debug("Running the post task");
|
||||||
Socket s = null;
|
Socket s = null;
|
||||||
|
@ -38,12 +38,10 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
private HashMap _events = new HashMap(4);
|
private HashMap _events = new HashMap(4);
|
||||||
private ArrayList _attached = new ArrayList();
|
private ArrayList _attached = new ArrayList();
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventDispatcher getEventDispatcher() {
|
public EventDispatcher getEventDispatcher() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void attachEventDispatcher(EventDispatcher ev) {
|
public void attachEventDispatcher(EventDispatcher ev) {
|
||||||
if (ev == null) return;
|
if (ev == null) return;
|
||||||
synchronized (_attached) {
|
synchronized (_attached) {
|
||||||
@ -52,7 +50,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detachEventDispatcher(EventDispatcher ev) {
|
public void detachEventDispatcher(EventDispatcher ev) {
|
||||||
if (ev == null) return;
|
if (ev == null) return;
|
||||||
synchronized (_attached) {
|
synchronized (_attached) {
|
||||||
@ -66,7 +63,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyEvent(String eventName, Object args) {
|
public void notifyEvent(String eventName, Object args) {
|
||||||
if (_ignore) return;
|
if (_ignore) return;
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
@ -89,7 +85,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getEventValue(String name) {
|
public Object getEventValue(String name) {
|
||||||
if (_ignore) return null;
|
if (_ignore) return null;
|
||||||
Object val;
|
Object val;
|
||||||
@ -112,7 +107,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ignoreEvents() {
|
public void ignoreEvents() {
|
||||||
_ignore = true;
|
_ignore = true;
|
||||||
synchronized (_events) {
|
synchronized (_events) {
|
||||||
@ -121,12 +115,10 @@ public class EventDispatcherImpl implements EventDispatcher {
|
|||||||
_events = null;
|
_events = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unIgnoreEvents() {
|
public void unIgnoreEvents() {
|
||||||
_ignore = false;
|
_ignore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object waitEventValue(String name) {
|
public Object waitEventValue(String name) {
|
||||||
if (_ignore) return null;
|
if (_ignore) return null;
|
||||||
Object val;
|
Object val;
|
||||||
|
@ -16,7 +16,6 @@ class Executor implements Runnable {
|
|||||||
runn = x;
|
runn = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
while(runn.getAnswer()) {
|
while(runn.getAnswer()) {
|
||||||
SimpleTimer.TimedEvent evt = null;
|
SimpleTimer.TimedEvent evt = null;
|
||||||
|
@ -111,7 +111,6 @@ public class I2PThread extends Thread {
|
|||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
I2PThread t = new I2PThread(new Runnable() {
|
I2PThread t = new I2PThread(new Runnable() {
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
throw new NullPointerException("blah");
|
throw new NullPointerException("blah");
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ class LogWriter implements Runnable {
|
|||||||
_write = false;
|
_write = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
_write = true;
|
_write = true;
|
||||||
try {
|
try {
|
||||||
|
@ -248,24 +248,20 @@ public class OrderedProperties extends Properties {
|
|||||||
_value = val;
|
_value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getKey() {
|
public Object getKey() {
|
||||||
return _key;
|
return _key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object setValue(Object value) {
|
public Object setValue(Object value) {
|
||||||
Object old = _value;
|
Object old = _value;
|
||||||
_value = value;
|
_value = value;
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
if (o == null) return -1;
|
if (o == null) return -1;
|
||||||
if (o instanceof StringMapEntry) return ((String) getKey()).compareTo((String)((StringMapEntry) o).getKey());
|
if (o instanceof StringMapEntry) return ((String) getKey()).compareTo((String)((StringMapEntry) o).getKey());
|
||||||
@ -359,7 +355,6 @@ public class OrderedProperties extends Properties {
|
|||||||
_props = props;
|
_props = props;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
int numRuns = 1000;
|
int numRuns = 1000;
|
||||||
_log.debug("Begin thrashing " + numRuns + " times");
|
_log.debug("Begin thrashing " + numRuns + " times");
|
||||||
|
@ -114,13 +114,11 @@ public class RandomSource extends SecureRandom implements EntropyHarvester {
|
|||||||
|
|
||||||
public EntropyHarvester harvester() { return _entropyHarvester; }
|
public EntropyHarvester harvester() { return _entropyHarvester; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void feedEntropy(String source, long data, int bitoffset, int bits) {
|
public void feedEntropy(String source, long data, int bitoffset, int bits) {
|
||||||
if (bitoffset == 0)
|
if (bitoffset == 0)
|
||||||
setSeed(data);
|
setSeed(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void feedEntropy(String source, byte[] data, int offset, int len) {
|
public void feedEntropy(String source, byte[] data, int offset, int len) {
|
||||||
if ( (offset == 0) && (len == data.length) ) {
|
if ( (offset == 0) && (len == data.length) ) {
|
||||||
setSeed(data);
|
setSeed(data);
|
||||||
|
Reference in New Issue
Block a user