sliices are only too slow if there's something pending
logging mods i really need to rewrite the tcp transport - the code is all functional, but the design sucks. with the FIFO bandwidth limiter we could get away with a single 'send' thread rather than each TCPConnection having its own writer thread (but we'd still need the per-con reader thread, at least until nio is solid enough) but maybe the rewrite can hold off until the AMOC implementation. we'll see
This commit is contained in:
@ -423,7 +423,15 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
|
|||||||
*/
|
*/
|
||||||
private boolean slicesTooLong() {
|
private boolean slicesTooLong() {
|
||||||
if (_lastSliceRun <= 0) return false;
|
if (_lastSliceRun <= 0) return false;
|
||||||
|
synchronized (_toBeSent) {
|
||||||
|
// if there's nothing pending, dont worry about it
|
||||||
|
if (_toBeSent.size() <= 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
long diff = _context.clock().now() - _lastSliceRun;
|
long diff = _context.clock().now() - _lastSliceRun;
|
||||||
|
boolean tooLong = diff > MAX_SLICE_DURATION;
|
||||||
|
if (tooLong)
|
||||||
|
_log.warn("Slices are taking " + diff + "ms");
|
||||||
return (diff > MAX_SLICE_DURATION);
|
return (diff > MAX_SLICE_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +550,7 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
|
|||||||
+ " bytes in " + (end - afterExpire) + "ms (write took "
|
+ " bytes in " + (end - afterExpire) + "ms (write took "
|
||||||
+ (end - beforeWrite) + "ms, prepare took "
|
+ (end - beforeWrite) + "ms, prepare took "
|
||||||
+ (beforeWrite - afterExpire) + "ms)");
|
+ (beforeWrite - afterExpire) + "ms)");
|
||||||
if (timeLeft < 10*1000) {
|
if (timeLeft < 2*1000) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.warn("Very little time left... time to send [" + (end-start)
|
_log.warn("Very little time left... time to send [" + (end-start)
|
||||||
+ "] time left [" + timeLeft + "] to "
|
+ "] time left [" + timeLeft + "] to "
|
||||||
|
Reference in New Issue
Block a user