log tweaks

This commit is contained in:
zzz
2013-09-27 01:48:12 +00:00
parent aefc5b5317
commit 9a00621fa4
2 changed files with 15 additions and 21 deletions

View File

@@ -687,7 +687,7 @@ class Packet {
protected StringBuilder formatAsString() { protected StringBuilder formatAsString() {
StringBuilder buf = new StringBuilder(64); StringBuilder buf = new StringBuilder(64);
buf.append(toId(_sendStreamId)); buf.append(toId(_sendStreamId));
//buf.append("<-->"); buf.append('/');
buf.append(toId(_receiveStreamId)).append(':'); buf.append(toId(_receiveStreamId)).append(':');
if (_sequenceNum != 0 || isFlagSet(FLAG_SYNCHRONIZE)) if (_sequenceNum != 0 || isFlagSet(FLAG_SYNCHRONIZE))
buf.append(" #").append(_sequenceNum); buf.append(" #").append(_sequenceNum);
@@ -696,8 +696,17 @@ class Packet {
// buf.append(" \t"); // so the tab lines up right // buf.append(" \t"); // so the tab lines up right
//else //else
// buf.append('\t'); // buf.append('\t');
buf.append(' '); toFlagString(buf);
buf.append(toFlagString()); if ( (_payload != null) && (_payload.getValid() > 0) )
buf.append(" data: ").append(_payload.getValid());
return buf;
}
static final String toId(long id) {
return Base64.encode(DataHelper.toLong(4, id)).replace("==", "");
}
private final void toFlagString(StringBuilder buf) {
if (isFlagSet(FLAG_NO_ACK)) if (isFlagSet(FLAG_NO_ACK))
buf.append(" NO_ACK"); buf.append(" NO_ACK");
else else
@@ -705,20 +714,9 @@ class Packet {
if (_nacks != null) { if (_nacks != null) {
buf.append(" NACK"); buf.append(" NACK");
for (int i = 0; i < _nacks.length; i++) { for (int i = 0; i < _nacks.length; i++) {
buf.append(" ").append(_nacks[i]); buf.append(' ').append(_nacks[i]);
} }
} }
if ( (_payload != null) && (_payload.getValid() > 0) )
buf.append(" data: ").append(_payload.getValid());
return buf;
}
static final String toId(long id) {
return Base64.encode(DataHelper.toLong(4, id));
}
private final String toFlagString() {
StringBuilder buf = new StringBuilder(32);
if (isFlagSet(FLAG_CLOSE)) buf.append(" CLOSE"); if (isFlagSet(FLAG_CLOSE)) buf.append(" CLOSE");
if (isFlagSet(FLAG_DELAY_REQUESTED)) buf.append(" DELAY ").append(_optionDelay); if (isFlagSet(FLAG_DELAY_REQUESTED)) buf.append(" DELAY ").append(_optionDelay);
if (isFlagSet(FLAG_ECHO)) buf.append(" ECHO"); if (isFlagSet(FLAG_ECHO)) buf.append(" ECHO");
@@ -729,7 +727,6 @@ class Packet {
if (isFlagSet(FLAG_SIGNATURE_INCLUDED)) buf.append(" SIG"); if (isFlagSet(FLAG_SIGNATURE_INCLUDED)) buf.append(" SIG");
if (isFlagSet(FLAG_SIGNATURE_REQUESTED)) buf.append(" SIGREQ"); if (isFlagSet(FLAG_SIGNATURE_REQUESTED)) buf.append(" SIGREQ");
if (isFlagSet(FLAG_SYNCHRONIZE)) buf.append(" SYN"); if (isFlagSet(FLAG_SYNCHRONIZE)) buf.append(" SYN");
return buf.toString();
} }
/** Generate a pcap/tcpdump-compatible format, /** Generate a pcap/tcpdump-compatible format,

View File

@@ -191,10 +191,6 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
public StringBuilder formatAsString() { public StringBuilder formatAsString() {
StringBuilder buf = super.formatAsString(); StringBuilder buf = super.formatAsString();
Connection con = _connection;
if (con != null)
buf.append(" rtt ").append(con.getOptions().getRTT());
//if ( (_tagsSent != null) && (!_tagsSent.isEmpty()) ) //if ( (_tagsSent != null) && (!_tagsSent.isEmpty()) )
// buf.append(" with tags"); // buf.append(" with tags");
final int nackCount = _nackCount.get(); final int nackCount = _nackCount.get();
@@ -213,6 +209,7 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
FLAG_CLOSE | FLAG_CLOSE |
FLAG_RESET)) { FLAG_RESET)) {
Connection con = _connection;
if (con != null) { if (con != null) {
buf.append(" from "); buf.append(" from ");
Destination local = con.getSession().getMyDestination(); Destination local = con.getSession().getMyDestination();