I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 0e17c560 authored by zzz's avatar zzz
Browse files

NTCP: Catch race in Reader (ticket #1534)

parent a3b13279
No related branches found
No related tags found
No related merge requests found
...@@ -98,8 +98,10 @@ class Reader { ...@@ -98,8 +98,10 @@ class Reader {
if (keepReading) { if (keepReading) {
// keep on reading the same one // keep on reading the same one
} else { } else {
_liveReads.remove(con); if (con != null) {
con = null; _liveReads.remove(con);
con = null;
}
if (_pendingConnections.isEmpty()) { if (_pendingConnections.isEmpty()) {
_pendingConnections.wait(); _pendingConnections.wait();
} else { } else {
...@@ -116,6 +118,10 @@ class Reader { ...@@ -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 { ...@@ -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()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment