Changeset 60aa8c5


Ignore:
Timestamp:
Nov 24, 2013 11:42:53 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
dbdf36d
Parents:
001070f6
Message:

I2PTunnel: Fix a shared client configured with i2cp.newDestOnResume
not restarting correctly, caused by previous checkin

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java

    r001070f6 r60aa8c5  
    253253        synchronized(sockLock) {
    254254            boolean newManager = false;
    255             if (this.sockMgr == null) {
     255            // other shared client could have destroyed it
     256            if (this.sockMgr == null || this.sockMgr.isDestroyed()) {
    256257                newManager = true;
    257258            } else {
     
    265266                        _log.warn(getTunnel().getClientOptions().getProperty("inbound.nickname") + ": Built a new destination on resume");
    266267                    // make sure the old one is closed
    267                     sockMgr.destroySocketManager();
     268                    // if it's shared client, it will be destroyed in getSocketManager()
     269                    // with the correct locking
     270                    boolean shouldDestroy;
     271                    synchronized(I2PTunnelClientBase.class) {
     272                        shouldDestroy = sockMgr != socketManager;
     273                    }
     274                    if (shouldDestroy)
     275                        sockMgr.destroySocketManager();
    268276                    newManager = true;
    269277                }  // else the old socket manager will reconnect the old session if necessary
     
    317325        // shadows instance _log
    318326        Log _log = tunnel.getContext().logManager().getLog(I2PTunnelClientBase.class);
    319         if (socketManager != null) {
     327        if (socketManager != null && !socketManager.isDestroyed()) {
    320328            I2PSession s = socketManager.getSession();
    321329            if (s.isClosed()) {
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManager.java

    r001070f6 r60aa8c5  
    105105     * method will block untill all the managed sockets are closed.
    106106     *
     107     * The socket manager CANNOT be reused after this.
    107108     */
    108109    public void destroySocketManager();
     110   
     111    /**
     112     * Has the socket manager been destroyed?
     113     *
     114     * @since 0.9.9
     115     */
     116    public boolean isDestroyed();
    109117
    110118    /**
  • apps/streaming/java/src/net/i2p/client/streaming/I2PSocketManagerFull.java

    r001070f6 r60aa8c5  
    340340
    341341    /**
     342     * Has the socket manager been destroyed?
     343     *
     344     * @since 0.9.9
     345     */
     346    public boolean isDestroyed() {
     347        return _isDestroyed.get();
     348    }
     349
     350    /**
    342351     * Retrieve a set of currently connected I2PSockets, either initiated locally or remotely.
    343352     *
  • router/java/src/net/i2p/router/RouterVersion.java

    r001070f6 r60aa8c5  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 31;
     21    public final static long BUILD = 32;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.