- Suppress log error on manual stop
- Prevent NPE when closing a delayed-open tunnel
This commit is contained in:
@ -375,7 +375,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
// This will build a new socket manager and a new dest if the session is closed.
|
// This will build a new socket manager and a new dest if the session is closed.
|
||||||
sockMgr = getSocketManager();
|
sockMgr = getSocketManager();
|
||||||
if (oldSockMgr != sockMgr) {
|
if (oldSockMgr != sockMgr) {
|
||||||
_log.error("Built a new destination on resume");
|
_log.warn("Built a new destination on resume");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // else the old socket manager will reconnect the old session if necessary
|
} // else the old socket manager will reconnect the old session if necessary
|
||||||
@ -431,8 +431,10 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
_context.statManager().addRateData("i2ptunnel.client.manageTime", total, total);
|
_context.statManager().addRateData("i2ptunnel.client.manageTime", total, total);
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
if (open) {
|
||||||
_log.error("Error listening for connections on " + localPort, ex);
|
_log.error("Error listening for connections on " + localPort, ex);
|
||||||
notifyEvent("openBaseClientResult", "error");
|
notifyEvent("openBaseClientResult", "error");
|
||||||
|
}
|
||||||
synchronized (sockLock) {
|
synchronized (sockLock) {
|
||||||
mySockets.clear();
|
mySockets.clear();
|
||||||
}
|
}
|
||||||
@ -513,6 +515,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
// might risk to create an orphan socket. Would be better
|
// might risk to create an orphan socket. Would be better
|
||||||
// to return with an error in that situation quickly.
|
// to return with an error in that situation quickly.
|
||||||
synchronized (sockLock) {
|
synchronized (sockLock) {
|
||||||
|
if (sockMgr != null) {
|
||||||
mySockets.retainAll(sockMgr.listSockets());
|
mySockets.retainAll(sockMgr.listSockets());
|
||||||
if (!forced && mySockets.size() != 0) {
|
if (!forced && mySockets.size() != 0) {
|
||||||
l.log("There are still active connections!");
|
l.log("There are still active connections!");
|
||||||
@ -526,7 +529,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
if (session != null) {
|
if (session != null) {
|
||||||
getTunnel().removeSession(session);
|
getTunnel().removeSession(session);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
l.log("Closing client " + toString());
|
l.log("Closing client " + toString());
|
||||||
|
open = false;
|
||||||
try {
|
try {
|
||||||
if (ss != null) ss.close();
|
if (ss != null) ss.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -534,7 +539,6 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
l.log("Client closed.");
|
l.log("Client closed.");
|
||||||
open = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (_waitingSockets) { _waitingSockets.notifyAll(); }
|
synchronized (_waitingSockets) { _waitingSockets.notifyAll(); }
|
||||||
|
Reference in New Issue
Block a user