Changeset bb51bf4


Ignore:
Timestamp:
Mar 24, 2009 8:24:20 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
41718b4
Parents:
6c365bef
Message:
  • Suppress log error on manual stop
  • Prevent NPE when closing a delayed-open tunnel
File:
1 edited

Legend:

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

    r6c365bef rbb51bf4  
    376376                sockMgr = getSocketManager();
    377377                if (oldSockMgr != sockMgr) {
    378                     _log.error("Built a new destination on resume");
     378                    _log.warn("Built a new destination on resume");
    379379                }
    380380            }
     
    432432            }
    433433        } catch (IOException ex) {
    434             _log.error("Error listening for connections on " + localPort, ex);
    435             notifyEvent("openBaseClientResult", "error");
     434            if (open) {
     435                _log.error("Error listening for connections on " + localPort, ex);
     436                notifyEvent("openBaseClientResult", "error");
     437            }
    436438            synchronized (sockLock) {
    437439                mySockets.clear();
     
    514516        // to return with an error in that situation quickly.
    515517        synchronized (sockLock) {
    516             mySockets.retainAll(sockMgr.listSockets());
    517             if (!forced && mySockets.size() != 0) {
    518                 l.log("There are still active connections!");
    519                 _log.debug("can't close: there are still active connections!");
    520                 for (Iterator it = mySockets.iterator(); it.hasNext();) {
    521                     l.log("->" + it.next());
    522                 }
    523                 return false;
    524             }
    525             I2PSession session = sockMgr.getSession();
    526             if (session != null) {
    527                 getTunnel().removeSession(session);
     518            if (sockMgr != null) {
     519                mySockets.retainAll(sockMgr.listSockets());
     520                if (!forced && mySockets.size() != 0) {
     521                    l.log("There are still active connections!");
     522                    _log.debug("can't close: there are still active connections!");
     523                    for (Iterator it = mySockets.iterator(); it.hasNext();) {
     524                        l.log("->" + it.next());
     525                    }
     526                    return false;
     527                }
     528                I2PSession session = sockMgr.getSession();
     529                if (session != null) {
     530                    getTunnel().removeSession(session);
     531                }
    528532            }
    529533            l.log("Closing client " + toString());
     534            open = false;
    530535            try {
    531536                if (ss != null) ss.close();
     
    535540            }
    536541            l.log("Client closed.");
    537             open = false;
    538542        }
    539543       
Note: See TracChangeset for help on using the changeset viewer.