* 2006-04-05 0.6.1.14 released
This commit is contained in:
@ -44,9 +44,9 @@ public class DatabaseLookupMessage extends I2NPMessageImpl {
|
||||
}
|
||||
public DatabaseLookupMessage(I2PAppContext context, boolean locallyCreated) {
|
||||
super(context);
|
||||
setSearchKey(null);
|
||||
setFrom(null);
|
||||
setDontIncludePeers(null);
|
||||
//setSearchKey(null);
|
||||
//setFrom(null);
|
||||
//setDontIncludePeers(null);
|
||||
|
||||
context.statManager().createRateStat("router.throttleNetDbDoSSend", "How many netDb lookup messages we are sending during a period with a DoS detected", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
|
||||
|
||||
|
@ -290,7 +290,11 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
|
||||
public void readMessage(byte data[], int offset, int dataSize, int type, I2NPMessageHandler handler) throws I2NPMessageException, IOException {
|
||||
// ignore the handler (overridden in subclasses if necessary
|
||||
readMessage(data, offset, dataSize, type);
|
||||
try {
|
||||
readMessage(data, offset, dataSize, type);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new I2NPMessageException("Error reading the message", iae);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -313,21 +317,23 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
|
||||
return msg;
|
||||
}
|
||||
|
||||
long expiration = DataHelper.fromLong(buffer, offset, 4) * 1000; // seconds
|
||||
offset += 4;
|
||||
int dataSize = len - 1 - 4;
|
||||
try {
|
||||
long expiration = DataHelper.fromLong(buffer, offset, 4) * 1000; // seconds
|
||||
offset += 4;
|
||||
int dataSize = len - 1 - 4;
|
||||
msg.readMessage(buffer, offset, dataSize, type, handler);
|
||||
msg.setMessageExpiration(expiration);
|
||||
msg.read();
|
||||
return msg;
|
||||
} catch (IOException ioe) {
|
||||
throw new I2NPMessageException("IO error reading raw message", ioe);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new I2NPMessageException("Corrupt message (negative expiration)", iae);
|
||||
}
|
||||
}
|
||||
|
||||
protected void verifyUnwritten() {
|
||||
// if (_written) throw new RuntimeException("Already written");
|
||||
if (_written) throw new RuntimeException("Already written");
|
||||
}
|
||||
protected void written() { _written = true; }
|
||||
protected void read() { _read = true; }
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.384 $ $Date: 2006/04/03 05:07:25 $";
|
||||
public final static String VERSION = "0.6.1.13";
|
||||
public final static long BUILD = 5;
|
||||
public final static String ID = "$Revision: 1.385 $ $Date: 2006/04/04 23:40:10 $";
|
||||
public final static String VERSION = "0.6.1.14";
|
||||
public final static long BUILD = 0;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -129,6 +129,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
||||
*/
|
||||
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) {
|
||||
//if (true) return super.search(key, onFindJob, onFailedLookupJob, timeoutMs, isLease);
|
||||
if (key == null) throw new IllegalArgumentException("searchin for nothin, eh?");
|
||||
boolean isNew = true;
|
||||
FloodSearchJob searchJob = null;
|
||||
synchronized (_activeFloodQueries) {
|
||||
|
@ -156,8 +156,11 @@ public class MessageReceiver {
|
||||
+ " raw: " + Base64.encode(fragments[i].getData()) + ")");
|
||||
off += fragments[i].getValid();
|
||||
}
|
||||
if (off != state.getCompleteSize())
|
||||
_log.error("Hmm, offset of the fragments = " + off + " while the state says " + state.getCompleteSize());
|
||||
if (off != state.getCompleteSize()) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Hmm, offset of the fragments = " + off + " while the state says " + state.getCompleteSize());
|
||||
return null;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Raw byte array for " + state.getMessageId() + ": " + Base64.encode(buf.getData(), 0, state.getCompleteSize()));
|
||||
I2NPMessage m = I2NPMessageImpl.fromRawByteArray(_context, buf.getData(), 0, state.getCompleteSize(), handler);
|
||||
|
@ -47,8 +47,7 @@ public class OutboundMessageState {
|
||||
public boolean initialize(OutNetMessage msg) {
|
||||
if (msg == null) return false;
|
||||
try {
|
||||
initialize(msg, msg.getMessage(), null);
|
||||
return true;
|
||||
return initialize(msg, msg.getMessage(), null);
|
||||
} catch (OutOfMemoryError oom) {
|
||||
throw oom;
|
||||
} catch (Exception e) {
|
||||
@ -62,8 +61,7 @@ public class OutboundMessageState {
|
||||
return false;
|
||||
|
||||
try {
|
||||
initialize(null, msg, peer);
|
||||
return true;
|
||||
return initialize(null, msg, peer);
|
||||
} catch (OutOfMemoryError oom) {
|
||||
throw oom;
|
||||
} catch (Exception e) {
|
||||
@ -77,8 +75,7 @@ public class OutboundMessageState {
|
||||
return false;
|
||||
|
||||
try {
|
||||
initialize(m, msg, null);
|
||||
return true;
|
||||
return initialize(m, msg, null);
|
||||
} catch (OutOfMemoryError oom) {
|
||||
throw oom;
|
||||
} catch (Exception e) {
|
||||
@ -87,7 +84,7 @@ public class OutboundMessageState {
|
||||
}
|
||||
}
|
||||
|
||||
private void initialize(OutNetMessage m, I2NPMessage msg, PeerState peer) {
|
||||
private boolean initialize(OutNetMessage m, I2NPMessage msg, PeerState peer) {
|
||||
_message = m;
|
||||
_peer = peer;
|
||||
if (_messageBuf != null) {
|
||||
@ -99,17 +96,24 @@ public class OutboundMessageState {
|
||||
int size = msg.getRawMessageSize();
|
||||
if (size > _messageBuf.getData().length)
|
||||
throw new IllegalArgumentException("Size too large! " + size + " in " + msg);
|
||||
int len = msg.toRawByteArray(_messageBuf.getData());
|
||||
_messageBuf.setValid(len);
|
||||
_messageId = msg.getUniqueId();
|
||||
|
||||
_startedOn = _context.clock().now();
|
||||
_nextSendTime = _startedOn;
|
||||
_expiration = _startedOn + 10*1000;
|
||||
//_expiration = msg.getExpiration();
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Raw byte array for " + _messageId + ": " + Base64.encode(_messageBuf.getData(), 0, len));
|
||||
try {
|
||||
int len = msg.toRawByteArray(_messageBuf.getData());
|
||||
_messageBuf.setValid(len);
|
||||
_messageId = msg.getUniqueId();
|
||||
|
||||
_startedOn = _context.clock().now();
|
||||
_nextSendTime = _startedOn;
|
||||
_expiration = _startedOn + 10*1000;
|
||||
//_expiration = msg.getExpiration();
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Raw byte array for " + _messageId + ": " + Base64.encode(_messageBuf.getData(), 0, len));
|
||||
return true;
|
||||
} catch (IllegalStateException ise) {
|
||||
_cache.release(_messageBuf);
|
||||
_messageBuf = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseResources() {
|
||||
|
@ -435,7 +435,7 @@ public class TunnelDispatcher implements Service {
|
||||
_context.statManager().addRateData("tunnel.dispatchInbound", 1, 0);
|
||||
} else {
|
||||
_context.messageHistory().droppedTunnelGatewayMessageUnknown(msg.getUniqueId(), msg.getTunnelId().getTunnelId());
|
||||
int level = (_context.router().getUptime() > 10*60*1000 ? Log.ERROR : Log.WARN);
|
||||
int level = (_context.router().getUptime() > 10*60*1000 ? Log.WARN : Log.INFO);
|
||||
if (_log.shouldLog(level))
|
||||
_log.log(level, "no matching tunnel for id=" + msg.getTunnelId().getTunnelId()
|
||||
+ ": gateway message expiring in "
|
||||
|
Reference in New Issue
Block a user