* BOB, SAM, i2psnark: Fix datagram NPE (ticket #1275)

This could only happen on an extremely overloaded router.
This commit is contained in:
zzz
2014-05-13 18:45:54 +00:00
parent 197be5f60f
commit 8480a204ea
5 changed files with 13 additions and 3 deletions

View File

@@ -106,8 +106,10 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
// _log.debug("Message available: id = " + msgId + " size = " + size); // _log.debug("Message available: id = " + msgId + " size = " + size);
try { try {
byte msg[] = session.receiveMessage(msgId); byte msg[] = session.receiveMessage(msgId);
out.write(msg); if (msg != null) {
out.flush(); out.write(msg);
out.flush();
}
} catch (I2PSessionException ise) { } catch (I2PSessionException ise) {
up = false; up = false;
} catch (IOException ioe) { } catch (IOException ioe) {

View File

@@ -1536,6 +1536,8 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
// TODO throttle // TODO throttle
try { try {
byte[] payload = session.receiveMessage(msgId); byte[] payload = session.receiveMessage(msgId);
if (payload == null)
return;
_rxPkts.incrementAndGet(); _rxPkts.incrementAndGet();
_rxBytes.addAndGet(payload.length); _rxBytes.addAndGet(payload.length);
if (toPort == _qPort) { if (toPort == _qPort) {

View File

@@ -234,6 +234,8 @@ public abstract class SAMMessageSession {
} }
try { try {
byte msg[] = session.receiveMessage(msgId); byte msg[] = session.receiveMessage(msgId);
if (msg == null)
return;
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Content of message " + msgId + ":\n" _log.debug("Content of message " + msgId + ":\n"
+ HexDump.dump(msg)); + HexDump.dump(msg));

View File

@@ -1,3 +1,7 @@
2014-05-13 zzz
* BOB, SAM, i2psnark: Fix datagram NPE (ticket #1275)
* SusiMail: Fix AIOOBE (ticket #1269)
2014-05-10 zzz 2014-05-10 zzz
* NTCP: Fix NPE (ticket #996) * NTCP: Fix NPE (ticket #996)
* SusiMail: Remove deleted mails from memory * SusiMail: Remove deleted mails from memory

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 17; public final static long BUILD = 18;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = "-rc"; public final static String EXTRA = "-rc";