Streaming: Fix race NPE (thx echelon)

This commit is contained in:
zzz
2012-02-20 19:34:13 +00:00
parent a15e4c6c28
commit ad8ce95545
4 changed files with 20 additions and 6 deletions

View File

@ -548,9 +548,11 @@ class Connection {
void disconnectComplete() {
_connected = false;
if (_socket != null)
_socket.destroy();
I2PSocketFull s = _socket;
if (s != null) {
s.destroy2();
_socket = null;
}
if (_outputStream != null)
_outputStream.destroy();
if (_receiver != null)

View File

@ -131,12 +131,21 @@ class I2PSocketFull implements I2PSocket {
void destroy() {
Connection c = _connection;
_connection = null;
_listener = null;
destroy2();
if (c != null)
c.disconnectComplete();
}
/**
* Call from Connection.disconnectComplete()
* instead of destroy() so we don't loop
* @since 0.8.13
*/
void destroy2() {
_connection = null;
_listener = null;
}
/**
* The remote port.
* @return the port or 0 if unknown

View File

@ -1,3 +1,6 @@
2012-02-20 zzz
* Streaming: Fix race NPE (thx echelon)
2012-02-17 zzz
* i2psnark: Escape fixes
* netdb.jsp: Fix debug median calculation

View File

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