fix disconnect race NPE
This commit is contained in:
@ -190,6 +190,7 @@ public class I2PSnarkUtil {
|
|||||||
*/
|
*/
|
||||||
public void disconnect() {
|
public void disconnect() {
|
||||||
I2PSocketManager mgr = _manager;
|
I2PSocketManager mgr = _manager;
|
||||||
|
// FIXME this can cause race NPEs elsewhere
|
||||||
_manager = null;
|
_manager = null;
|
||||||
_shitlist.clear();
|
_shitlist.clear();
|
||||||
mgr.destroySocketManager();
|
mgr.destroySocketManager();
|
||||||
@ -201,6 +202,9 @@ public class I2PSnarkUtil {
|
|||||||
|
|
||||||
/** connect to the given destination */
|
/** connect to the given destination */
|
||||||
I2PSocket connect(PeerID peer) throws IOException {
|
I2PSocket connect(PeerID peer) throws IOException {
|
||||||
|
I2PSocketManager mgr = _manager;
|
||||||
|
if (mgr == null)
|
||||||
|
throw new IOException("No socket manager");
|
||||||
Destination addr = peer.getAddress();
|
Destination addr = peer.getAddress();
|
||||||
if (addr == null)
|
if (addr == null)
|
||||||
throw new IOException("Null address");
|
throw new IOException("Null address");
|
||||||
|
Reference in New Issue
Block a user