diff --git a/router/java/src/net/i2p/router/transport/udp/MessageReceiver.java b/router/java/src/net/i2p/router/transport/udp/MessageReceiver.java index 276d2d1c8e2d15aeced68414e1dd79784a3462cc..a699aaa159ee8ee9b9d1f100fbf25370f965a2e7 100644 --- a/router/java/src/net/i2p/router/transport/udp/MessageReceiver.java +++ b/router/java/src/net/i2p/router/transport/udp/MessageReceiver.java @@ -202,16 +202,13 @@ class MessageReceiver { // zero copy for single fragment m = I2NPMessageImpl.fromRawByteArray(_context, state.getFragments()[0].getData(), 0, state.getCompleteSize(), handler); } - if (state.getCompleteSize() == 534 && _log.shouldLog(Log.INFO)) { - _log.info(HexDump.dump(buf.getData(), 0, state.getCompleteSize())); - } m.setUniqueId(state.getMessageId()); return m; } catch (I2NPMessageException ime) { if (_log.shouldLog(Log.WARN)) { _log.warn("Message invalid: " + state, ime); - _log.warn(HexDump.dump(buf.getData(), 0, state.getCompleteSize())); - _log.warn("RAW: " + Base64.encode(buf.getData(), 0, state.getCompleteSize())); + _log.warn("DUMP:\n" + HexDump.dump(buf.getData(), 0, state.getCompleteSize())); + _log.warn("RAW:\n" + Base64.encode(buf.getData(), 0, state.getCompleteSize())); } _context.messageHistory().droppedInboundMessage(state.getMessageId(), state.getFrom(), "error: " + ime.toString() + ": " + state.toString()); return null; diff --git a/router/java/src/net/i2p/router/tunnel/FragmentHandler.java b/router/java/src/net/i2p/router/tunnel/FragmentHandler.java index 0d25b8cfab87e9e08332286cc073654533d76790..736a19a284d162ce705e1b1c110adce2b6431fd8 100644 --- a/router/java/src/net/i2p/router/tunnel/FragmentHandler.java +++ b/router/java/src/net/i2p/router/tunnel/FragmentHandler.java @@ -14,6 +14,7 @@ import net.i2p.data.i2np.I2NPMessageException; import net.i2p.data.i2np.I2NPMessageHandler; import net.i2p.router.RouterContext; import net.i2p.util.ByteCache; +import net.i2p.util.HexDump; import net.i2p.util.Log; import net.i2p.util.SimpleByteCache; import net.i2p.util.SimpleTimer; @@ -468,10 +469,11 @@ class FragmentHandler { String stringified = null; if (_log.shouldLog(Log.DEBUG)) stringified = msg.toString(); + byte data[] = null; try { int fragmentCount = msg.getFragmentCount(); // toByteArray destroys the contents of the message completely - byte data[] = msg.toByteArray(); + data = msg.toByteArray(); if (data == null) throw new I2NPMessageException("null data"); // fragments already released??? if (_log.shouldLog(Log.DEBUG)) @@ -488,14 +490,13 @@ class FragmentHandler { noteReception(m.getUniqueId(), fragmentCount-1, "complete: ");// + msg.toString()); noteCompletion(m.getUniqueId()); _receiver.receiveComplete(m, msg.getTargetRouter(), msg.getTargetTunnel()); - } catch (IOException ioe) { - if (stringified == null) stringified = msg.toString(); - if (_log.shouldLog(Log.ERROR)) - _log.error("Error receiving fragmented message (corrupt?): " + stringified, ioe); } catch (I2NPMessageException ime) { if (stringified == null) stringified = msg.toString(); - if (_log.shouldLog(Log.WARN)) + if (_log.shouldLog(Log.WARN)) { _log.warn("Error receiving fragmented message (corrupt?): " + stringified, ime); + _log.warn("DUMP:\n" + HexDump.dump(data)); + _log.warn("RAW:\n" + Base64.encode(data)); + } } }