2005-12-30 jrandom
* Small streaming lib bugfixes for the modified timeouts * Minor Syndie/Sucker RSS html fix * Small synchronization fix in I2PSnark (thanks fsm!)
This commit is contained in:
@ -401,7 +401,9 @@ class PeerState
|
||||
// Are there outstanding requests that have to be resend?
|
||||
if (resend)
|
||||
{
|
||||
out.sendRequests(outstandingRequests);
|
||||
synchronized (this) {
|
||||
out.sendRequests(outstandingRequests);
|
||||
}
|
||||
resend = false;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
|
||||
private int _maxBufferSize;
|
||||
|
||||
public static final int DEFAULT_BUFFER_SIZE = 1024*64;
|
||||
public static final int DEFAULT_WRITE_TIMEOUT = 60*1000;
|
||||
public static final int DEFAULT_WRITE_TIMEOUT = -1;
|
||||
public static final int DEFAULT_CONNECT_TIMEOUT = 60*1000;
|
||||
|
||||
public I2PSocketOptionsImpl() {
|
||||
|
@ -123,8 +123,8 @@ public class Connection {
|
||||
_context.statManager().createRateStat("stream.con.windowSizeAtCongestion", "How large was our send window when we send a dup?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
|
||||
_context.statManager().createRateStat("stream.chokeSizeBegin", "How many messages were outstanding when we started to choke?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
|
||||
_context.statManager().createRateStat("stream.chokeSizeEnd", "How many messages were outstanding when we stopped being choked?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("New connection created with options: " + _options);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("New connection created with options: " + _options);
|
||||
}
|
||||
|
||||
public long getNextOutboundPacketNum() {
|
||||
@ -164,11 +164,13 @@ public class Connection {
|
||||
started = true;
|
||||
if ( (_outboundPackets.size() >= _options.getWindowSize()) || (_activeResends > 0) ||
|
||||
(_lastSendId - _highestAckedThrough > _options.getWindowSize()) ) {
|
||||
if (writeExpire > 0) {
|
||||
if (timeoutMs > 0) {
|
||||
if (timeLeft <= 0) {
|
||||
_log.error("Outbound window is full of " + _outboundPackets.size()
|
||||
+ " with " + _activeResends + " active resends"
|
||||
+ " and we've waited too long (" + writeExpire + "ms)");
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Outbound window is full of " + _outboundPackets.size()
|
||||
+ " with " + _activeResends + " active resends"
|
||||
+ " and we've waited too long (" + (0-(timeLeft - timeoutMs)) + "ms): "
|
||||
+ toString());
|
||||
return false;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -387,8 +389,8 @@ public class Connection {
|
||||
_ackedPackets++;
|
||||
if (p.getNumSends() > 1) {
|
||||
_activeResends--;
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Active resend of " + p + " successful, # active left: " + _activeResends);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Active resend of " + p + " successful, # active left: " + _activeResends);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -355,6 +355,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
|
||||
buf.append(" cwin=").append(_windowSize);
|
||||
buf.append(" maxResends=").append(_maxResends);
|
||||
buf.append(" writeTimeout=").append(getWriteTimeout());
|
||||
buf.append(" readTimeout=").append(getReadTimeout());
|
||||
buf.append(" inactivityTimeout=").append(_inactivityTimeout);
|
||||
buf.append(" inboundBuffer=").append(_inboundBufferSize);
|
||||
buf.append(" maxWindowSize=").append(_maxWindowSize);
|
||||
|
@ -158,7 +158,11 @@ public class MessageInputStream extends InputStream {
|
||||
* but if it is 0, do not block at all)
|
||||
*/
|
||||
public int getReadTimeout() { return _readTimeout; }
|
||||
public void setReadTimeout(int timeout) { _readTimeout = timeout; }
|
||||
public void setReadTimeout(int timeout) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Changing read timeout from " + _readTimeout + " to " + timeout);
|
||||
_readTimeout = timeout;
|
||||
}
|
||||
|
||||
public void closeReceived() {
|
||||
synchronized (_dataLock) {
|
||||
@ -302,8 +306,8 @@ public class MessageInputStream extends InputStream {
|
||||
throwAnyError();
|
||||
} else { // readTimeout == 0
|
||||
// noop, don't block
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("read(...," + offset+", " + length+ ")[" + i
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("read(...," + offset+", " + length+ ")[" + i
|
||||
+ ") with nonblocking setup: " + toString());
|
||||
return i;
|
||||
}
|
||||
@ -320,8 +324,8 @@ public class MessageInputStream extends InputStream {
|
||||
// we looped a few times then got data, so this pass doesnt count
|
||||
i--;
|
||||
} else if (_readyDataBlocks.size() <= 0) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("read(...," + offset+", " + length+ ")[" + i
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("read(...," + offset+", " + length+ ")[" + i
|
||||
+ "] no more ready blocks, returning");
|
||||
return i;
|
||||
} else {
|
||||
@ -351,7 +355,7 @@ public class MessageInputStream extends InputStream {
|
||||
} // synchronized (_dataLock)
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.info("read(...," + offset+", " + length+ ") read fully total read: " +_readTotal);
|
||||
_log.debug("read(...," + offset+", " + length+ ") read fully total read: " +_readTotal);
|
||||
|
||||
return length;
|
||||
}
|
||||
@ -370,7 +374,7 @@ public class MessageInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.info("available(): " + numBytes + " " + toString());
|
||||
_log.debug("available(): " + numBytes + " " + toString());
|
||||
|
||||
return numBytes;
|
||||
}
|
||||
|
@ -68,7 +68,12 @@ public class MessageOutputStream extends OutputStream {
|
||||
_log.debug("MessageOutputStream created");
|
||||
}
|
||||
|
||||
public void setWriteTimeout(int ms) { _writeTimeout = ms; }
|
||||
public void setWriteTimeout(int ms) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Changing write timeout from " + _writeTimeout + " to " + ms);
|
||||
|
||||
_writeTimeout = ms;
|
||||
}
|
||||
public int getWriteTimeout() { return _writeTimeout; }
|
||||
public void setBufferSize(int size) { _nextBufferSize = size; }
|
||||
|
||||
|
@ -516,7 +516,8 @@ public class Packet {
|
||||
boolean ok = ctx.dsa().verifySignature(_optionSignature, buffer, 0, size, from.getSigningPublicKey());
|
||||
if (!ok) {
|
||||
Log l = ctx.logManager().getLog(Packet.class);
|
||||
l.error("Signature failed on " + toString(), new Exception("moo"));
|
||||
if (l.shouldLog(Log.WARN))
|
||||
l.warn("Signature failed on " + toString(), new Exception("moo"));
|
||||
if (false) {
|
||||
l.error(Base64.encode(buffer, 0, size));
|
||||
l.error("Signature: " + Base64.encode(_optionSignature.getData()));
|
||||
|
@ -581,8 +581,10 @@ public class Sucker {
|
||||
|
||||
a=htmlTagLowerCase.indexOf("href=\"")+6;
|
||||
b=a+1;
|
||||
while(htmlTagLowerCase.charAt(b)!='\"')
|
||||
while ( (b < htmlTagLowerCase.length()) && (htmlTagLowerCase.charAt(b)!='\"') )
|
||||
b++;
|
||||
if (b >= htmlTagLowerCase.length())
|
||||
return null; // abort the b0rked tag
|
||||
String link=htmlTag.substring(a,b);
|
||||
if(link.indexOf("http")<0)
|
||||
link=baseUrl+"/"+link;
|
||||
|
@ -1,4 +1,9 @@
|
||||
$Id: history.txt,v 1.372 2005/12/29 08:07:22 jrandom Exp $
|
||||
$Id: history.txt,v 1.373 2005/12/30 13:16:46 jrandom Exp $
|
||||
|
||||
2005-12-30 jrandom
|
||||
* Small streaming lib bugfixes for the modified timeouts
|
||||
* Minor Syndie/Sucker RSS html fix
|
||||
* Small synchronization fix in I2PSnark (thanks fsm!)
|
||||
|
||||
2005-12-30 jrandom
|
||||
* Replaced the bundled linux jcpuid (written in C++) with scintilla's
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.319 $ $Date: 2005/12/27 08:20:54 $";
|
||||
public final static String ID = "$Revision: 1.320 $ $Date: 2005/12/29 08:07:24 $";
|
||||
public final static String VERSION = "0.6.1.8";
|
||||
public final static long BUILD = 3;
|
||||
public final static long BUILD = 4;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -53,7 +53,7 @@ public class InboundMessageState {
|
||||
public boolean receiveFragment(UDPPacketReader.DataReader data, int dataFragment) {
|
||||
int fragmentNum = data.readMessageFragmentNum(dataFragment);
|
||||
if ( (fragmentNum < 0) || (fragmentNum > _fragments.length)) {
|
||||
_log.error("Invalid fragment " + fragmentNum + "/" + _fragments.length);
|
||||
_log.warn("Invalid fragment " + fragmentNum + "/" + _fragments.length);
|
||||
return false;
|
||||
}
|
||||
if (_fragments[fragmentNum] == null) {
|
||||
@ -73,7 +73,7 @@ public class InboundMessageState {
|
||||
+ ", isLast=" + isLast
|
||||
+ ", data=" + Base64.encode(message.getData(), 0, size));
|
||||
} catch (ArrayIndexOutOfBoundsException aioobe) {
|
||||
_log.error("Corrupt SSU fragment " + fragmentNum, aioobe);
|
||||
_log.warn("Corrupt SSU fragment " + fragmentNum, aioobe);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user