forked from I2P_Developers/i2p.i2p
NTCP: Catch race in Reader (ticket #1534)
This commit is contained in:
@@ -98,8 +98,10 @@ class Reader {
|
|||||||
if (keepReading) {
|
if (keepReading) {
|
||||||
// keep on reading the same one
|
// keep on reading the same one
|
||||||
} else {
|
} else {
|
||||||
|
if (con != null) {
|
||||||
_liveReads.remove(con);
|
_liveReads.remove(con);
|
||||||
con = null;
|
con = null;
|
||||||
|
}
|
||||||
if (_pendingConnections.isEmpty()) {
|
if (_pendingConnections.isEmpty()) {
|
||||||
_pendingConnections.wait();
|
_pendingConnections.wait();
|
||||||
} else {
|
} else {
|
||||||
@@ -116,6 +118,10 @@ class Reader {
|
|||||||
_log.debug("begin read for " + con);
|
_log.debug("begin read for " + con);
|
||||||
try {
|
try {
|
||||||
processRead(con);
|
processRead(con);
|
||||||
|
} catch (IllegalStateException ise) {
|
||||||
|
// FailedEstablishState.receive() (race - see below)
|
||||||
|
if (_log.shouldWarn())
|
||||||
|
_log.warn("Error in the ntcp reader", ise);
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
_log.log(Log.CRIT, "Error in the ntcp reader", re);
|
_log.log(Log.CRIT, "Error in the ntcp reader", re);
|
||||||
}
|
}
|
||||||
@@ -153,6 +159,7 @@ class Reader {
|
|||||||
EventPumper.releaseBuf(buf);
|
EventPumper.releaseBuf(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// FIXME call est.isCorrupt() before also? throws ISE here... see above
|
||||||
est.receive(buf);
|
est.receive(buf);
|
||||||
EventPumper.releaseBuf(buf);
|
EventPumper.releaseBuf(buf);
|
||||||
if (est.isCorrupt()) {
|
if (est.isCorrupt()) {
|
||||||
|
Reference in New Issue
Block a user