forked from I2P_Developers/i2p.i2p
getSession() cannot be null
This commit is contained in:
@ -255,9 +255,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
newManager = true;
|
||||
} else {
|
||||
I2PSession sess = sockMgr.getSession();
|
||||
if (sess == null) {
|
||||
newManager = true;
|
||||
} else if (sess.isClosed() &&
|
||||
if (sess.isClosed() &&
|
||||
Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")) &&
|
||||
Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume"))) {
|
||||
// build a new socket manager and a new dest if the session is closed.
|
||||
@ -317,7 +315,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
Log _log = tunnel.getContext().logManager().getLog(I2PTunnelClientBase.class);
|
||||
if (socketManager != null) {
|
||||
I2PSession s = socketManager.getSession();
|
||||
if ( (s == null) || (s.isClosed()) ) {
|
||||
if (s.isClosed()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since the old one closed [s=" + s + "]");
|
||||
if (s != null)
|
||||
@ -709,9 +707,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
if (!chained) {
|
||||
I2PSession session = sockMgr.getSession();
|
||||
if (session != null) {
|
||||
getTunnel().removeSession(session);
|
||||
}
|
||||
getTunnel().removeSession(session);
|
||||
} // else the app chaining to this one closes it!
|
||||
}
|
||||
l.log("Stopping client " + toString());
|
||||
|
@ -922,7 +922,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
// use existing session to look up for efficiency
|
||||
verifySocketManager();
|
||||
I2PSession sess = sockMgr.getSession();
|
||||
if(sess != null && !sess.isClosed()) {
|
||||
if(!sess.isClosed()) {
|
||||
byte[] hData = Base32.decode(destination.substring(0, 52));
|
||||
if(hData != null) {
|
||||
if(_log.shouldLog(Log.INFO)) {
|
||||
|
@ -28,6 +28,10 @@ import net.i2p.data.Destination;
|
||||
*
|
||||
*/
|
||||
public interface I2PSocketManager {
|
||||
|
||||
/**
|
||||
* @return the session, non-null
|
||||
*/
|
||||
public I2PSession getSession();
|
||||
|
||||
/**
|
||||
|
@ -65,10 +65,10 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
* This is what I2PSocketManagerFactory.createManager() returns.
|
||||
* Direct instantiation by others is deprecated.
|
||||
*
|
||||
* @param context
|
||||
* @param session
|
||||
* @param opts
|
||||
* @param name
|
||||
* @param context non-null
|
||||
* @param session non-null
|
||||
* @param opts may be null
|
||||
* @param name non-null
|
||||
*/
|
||||
public I2PSocketManagerFull(I2PAppContext context, I2PSession session, Properties opts, String name) {
|
||||
_context = context;
|
||||
@ -103,6 +103,9 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
return curOpts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the session, non-null
|
||||
*/
|
||||
public I2PSession getSession() {
|
||||
return _session;
|
||||
}
|
||||
|
Reference in New Issue
Block a user