This commit is contained in:
zzz
2009-02-06 21:19:45 +00:00
parent e7bccb2f47
commit 06e1305df2

View File

@ -134,9 +134,11 @@ public class I2CPMessageReader {
public void cancelRunner() {
_doRun = false;
_stayAlive = false;
if (_stream != null) {
// prevent race NPE
InputStream in = _stream;
if (in != null) {
try {
_stream.close();
in.close();
} catch (IOException ioe) {
_log.error("Error closing the stream", ioe);
}
@ -164,6 +166,7 @@ public class I2CPMessageReader {
_listener.disconnected(I2CPMessageReader.this);
cancelRunner();
} catch (OutOfMemoryError oom) {
// ooms seen here... maybe log and keep going?
throw oom;
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled error reading I2CP stream", e);