Changeset 1826fce


Ignore:
Timestamp:
Feb 12, 2018 5:25:35 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6193e48
Parents:
2999638
Message:

i2ptunnel: Close sockets on error

Location:
apps/i2ptunnel/java/src/net/i2p/i2ptunnel
Files:
2 edited

Legend:

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

    r2999638 r1826fce  
    811811                // close-on-idle tunnel (in connectManager() above)
    812812                _log.error("Uncaught error in i2ptunnel client", t);
     813                try { _s.close(); } catch (IOException ioe) {}
    813814            }
    814815        }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java

    r2999638 r1826fce  
    548548            _clientExecutor = new TunnelControllerGroup.CustomThreadPoolExecutor();
    549549        }
     550        I2PSocket i2ps = null;
    550551        while (open) {
    551552            try {
     553                i2ps = null;
    552554                I2PServerSocket ci2pss = i2pss;
    553555                if (ci2pss == null)
    554556                    throw new I2PException("I2PServerSocket closed");
    555                 final I2PSocket i2ps = ci2pss.accept();
     557                i2ps = ci2pss.accept();
    556558                if (i2ps == null) throw new I2PException("I2PServerSocket closed");
    557559                if (_usePool) {
     
    577579                // TODO delay and loop if internal router is soft restarting?
    578580                open = false;
     581                if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}
    579582                break;
    580583            } catch (ConnectException ce) {
     
    582585                    _log.error("Error accepting", ce);
    583586                open = false;
     587                if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}
    584588                break;
    585589            } catch(SocketTimeoutException ste) {
    586590                // ignored, we never set the timeout
     591                if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}
    587592            } catch (RuntimeException e) {
    588593                // streaming borkage
    589594                if (_log.shouldLog(Log.ERROR))
    590595                    _log.error("Uncaught exception accepting", e);
     596                if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}
    591597                // not killing the server..
    592598                try {
Note: See TracChangeset for help on using the changeset viewer.