logging, including replacing the scary monster with its true self (we had data queued up, but were unable to get an ACK on our last write)

This commit is contained in:
jrandom
2004-07-16 20:48:40 +00:00
committed by zzz
parent f0b6cbaf89
commit 37d5531737
2 changed files with 10 additions and 6 deletions

View File

@@ -454,7 +454,8 @@ class I2PSocketImpl implements I2PSocket {
_log.debug(getPrefix() + "Message size is: " + data.length); _log.debug(getPrefix() + "Message size is: " + data.length);
boolean sent = sendBlock(data); boolean sent = sendBlock(data);
if (!sent) { if (!sent) {
_log.error(getPrefix() + "Error sending message to peer. Killing socket runner"); if (_log.shouldLog(Log.WARN))
_log.warn(getPrefix() + "Error sending message to peer. Killing socket runner");
errorOccurred(); errorOccurred();
return false; return false;
} }
@@ -475,9 +476,10 @@ class I2PSocketImpl implements I2PSocket {
packetsHandled++; packetsHandled++;
} }
if ((bc.getCurrentSize() > 0) && (packetsHandled > 1)) { if ((bc.getCurrentSize() > 0) && (packetsHandled > 1)) {
_log.error(getPrefix() + "A SCARY MONSTER HAS EATEN SOME DATA! " + "(input stream: " if (_log.shouldLog(Log.WARN))
+ in.hashCode() + "; " _log.warn(getPrefix() + "We lost some data queued up due to a network send error (input stream: "
+ "queue size: " + bc.getCurrentSize() + ")"); + in.hashCode() + "; "
+ "queue size: " + bc.getCurrentSize() + ")");
} }
synchronized (flagLock) { synchronized (flagLock) {
closed2 = true; closed2 = true;
@@ -492,7 +494,8 @@ class I2PSocketImpl implements I2PSocket {
byte[] packet = I2PSocketManager.makePacket(getMask(0x02), remoteID, new byte[0]); byte[] packet = I2PSocketManager.makePacket(getMask(0x02), remoteID, new byte[0]);
boolean sent = manager.getSession().sendMessage(remote, packet); boolean sent = manager.getSession().sendMessage(remote, packet);
if (!sent) { if (!sent) {
_log.error(getPrefix() + "Error sending close packet to peer"); if (_log.shouldLog(Log.WARN))
_log.warn(getPrefix() + "Error sending close packet to peer");
errorOccurred(); errorOccurred();
} }
} }

View File

@@ -264,7 +264,8 @@ public class I2PSocketManager implements I2PSessionListener {
s.queueData(payload); s.queueData(payload);
return; return;
} else { } else {
_log.error(getName() + ": Null socket with data available"); if (_log.shouldLog(Log.WARN))
_log.warn(getName() + ": Null socket with data available");
throw new IllegalStateException("Null socket with data available"); throw new IllegalStateException("Null socket with data available");
} }
} }