forked from I2P_Developers/i2p.i2p
(no, this doesnt fix things yet, but its a save point along the path)
2005-03-11 jrandom * Rather than the fixed resend timeout floor (10s), use 10s+RTT as the minimum (increased on resends as before, of course). * Always prod the clock update listeners, even if just to tell them that the time hasn't changed much. * Added support for explicit peer selection for individual tunnel pools, which will be useful in debugging but not recommended for use by normal end users. * More aggressively search for the next hop's routerInfo on tunnel join. * Give messages received via inbound tunnels that are bound to remote locations sufficient time (taking into account clock skew). * Give alternate direct send messages sufficient time (10s min, not 5s) * Always give the end to end data message the explicit timeout (though the old default was sufficient before) * No need to give end to end messages an insane expiration (+2m), as we are already handling skew on the receiving side. * Don't complain too loudly about expired TunnelCreateMessages (at least, not until after all those 0.5 and 0.5.0.1 users upgrade ;) * Properly keep the sendBps stat * When running the router with router.keepHistory=true, log more data to messageHistory.txt * Logging updates * Minor formatting updates
This commit is contained in:
@ -258,7 +258,7 @@ public class Connection {
|
||||
}
|
||||
packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
|
||||
|
||||
long timeout = (_options.getRTT() < MIN_RESEND_DELAY ? MIN_RESEND_DELAY : _options.getRTT());
|
||||
long timeout = _options.getRTT() + MIN_RESEND_DELAY;
|
||||
if (timeout > MAX_RESEND_DELAY)
|
||||
timeout = MAX_RESEND_DELAY;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
|
@ -552,6 +552,11 @@ public class Packet {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer str = formatAsString();
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
protected StringBuffer formatAsString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append(toId(_sendStreamId));
|
||||
//buf.append("<-->");
|
||||
@ -570,7 +575,7 @@ public class Packet {
|
||||
}
|
||||
if ( (_payload != null) && (_payload.getValid() > 0) )
|
||||
buf.append(" data: ").append(_payload.getValid());
|
||||
return buf.toString();
|
||||
return buf;
|
||||
}
|
||||
|
||||
private static final String toId(byte id[]) {
|
||||
|
@ -107,11 +107,15 @@ public class PacketHandler {
|
||||
private static final SimpleDateFormat _fmt = new SimpleDateFormat("HH:mm:ss.SSS");
|
||||
void displayPacket(Packet packet, String prefix, String suffix) {
|
||||
if (!_log.shouldLog(Log.DEBUG)) return;
|
||||
String msg = null;
|
||||
StringBuffer buf = new StringBuffer(256);
|
||||
synchronized (_fmt) {
|
||||
msg = _fmt.format(new Date()) + ": " + prefix + " " + packet.toString() + (suffix != null ? " " + suffix : "");
|
||||
buf.append(_fmt.format(new Date()));
|
||||
}
|
||||
System.out.println(msg);
|
||||
buf.append(": ").append(prefix).append(" ");
|
||||
buf.append(packet.toString());
|
||||
if (suffix != null)
|
||||
buf.append(" ").append(suffix);
|
||||
System.out.println(buf.toString());
|
||||
}
|
||||
|
||||
private void receiveKnownCon(Connection con, Packet packet) {
|
||||
|
@ -114,16 +114,44 @@ public class PacketLocal extends Packet implements MessageOutputStream.WriteStat
|
||||
|
||||
public void setResendPacketEvent(SimpleTimer.TimedEvent evt) { _resendEvent = evt; }
|
||||
|
||||
public String toString() {
|
||||
String str = super.toString();
|
||||
public StringBuffer formatAsString() {
|
||||
StringBuffer buf = super.formatAsString();
|
||||
|
||||
Connection con = _connection;
|
||||
if (con != null)
|
||||
buf.append(" rtt ").append(con.getOptions().getRTT());
|
||||
|
||||
if ( (_tagsSent != null) && (_tagsSent.size() > 0) )
|
||||
str = str + " with tags";
|
||||
buf.append(" with tags");
|
||||
|
||||
if (_ackOn > 0)
|
||||
return str + " ack after " + getAckTime() + (_numSends <= 1 ? "" : " sent " + _numSends + " times");
|
||||
else
|
||||
return str + (_numSends <= 1 ? "" : " sent " + _numSends + " times");
|
||||
buf.append(" ack after ").append(getAckTime());
|
||||
|
||||
if (_numSends > 1)
|
||||
buf.append(" sent ").append(_numSends).append(" times");
|
||||
|
||||
if (isFlagSet(Packet.FLAG_SYNCHRONIZE) ||
|
||||
isFlagSet(Packet.FLAG_CLOSE) ||
|
||||
isFlagSet(Packet.FLAG_RESET)) {
|
||||
|
||||
if (con != null) {
|
||||
buf.append(" from ");
|
||||
Destination local = con.getSession().getMyDestination();
|
||||
if (local != null)
|
||||
buf.append(local.calculateHash().toBase64().substring(0,4));
|
||||
else
|
||||
buf.append("unknown");
|
||||
|
||||
buf.append(" to ");
|
||||
Destination remote = con.getRemotePeer();
|
||||
if (remote != null)
|
||||
buf.append(remote.calculateHash().toBase64().substring(0,4));
|
||||
else
|
||||
buf.append("unknown");
|
||||
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
public void waitForAccept(int maxWaitMs) {
|
||||
|
Reference in New Issue
Block a user