Changeset e7cfb2d


Ignore:
Timestamp:
Mar 13, 2017 2:09:27 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1150b4cd
Parents:
ad810de
Message:

Streaming: Add reset() to I2PSocket API
i2ptunnel: Reset I2P socket on TCP socket errors, in standard servers
that don't have protocol responses
SAM: Reset I2P socket on handler errors

Files:
11 edited

Legend:

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

    rad810de re7cfb2d  
    211211        } catch (IOException ex) {
    212212            try {
    213                 socket.close();
     213                socket.reset();
    214214            } catch (IOException ioe) {}
    215215            if (_log.shouldLog(Log.WARN))
     
    217217        } catch (OutOfMemoryError oom) {
    218218            try {
    219                 socket.close();
     219                socket.reset();
    220220            } catch (IOException ioe) {}
    221221            if (_log.shouldLog(Log.ERROR))
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java

    rad810de re7cfb2d  
    681681        } catch (SocketException ex) {
    682682            try {
    683                 socket.close();
     683                socket.reset();
    684684            } catch (IOException ioe) {}
    685685            if (_log.shouldLog(Log.ERROR))
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/I2PTunnelDCCServer.java

    rad810de re7cfb2d  
    120120            } catch (SocketException ex) {
    121121                try {
    122                     socket.close();
     122                    socket.reset();
    123123                } catch (IOException ioe) {}
    124124                _log.error("Error relaying incoming DCC connection to IRC client at " + local.ia + ':' + local.port, ex);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SocketWrapper.java

    rad810de re7cfb2d  
    8888    }
    8989
     90    /**
     91     * Just calls close()
     92     * @since 0.9.30
     93     */
     94    public void reset() throws IOException {
     95        close();
     96    }
     97
    9098    public boolean isClosed() {
    9199        return socket.isClosed();
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java

    rad810de re7cfb2d  
    113113     */
    114114    public int getLocalPort();
     115   
     116    /**
     117     *  Resets and closes this socket. Sends a RESET indication to the far-end.
     118     *  This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket.
     119     *
     120     *  Nonblocking.
     121     *  Any thread currently blocked in an I/O operation upon this socket will throw an IOException.
     122     *  Once a socket has been reset, it is not available for further networking use
     123     *  (i.e. can't be reconnected or rebound). A new socket needs to be created.
     124     *  Resetting this socket will also close the socket's InputStream and OutputStream.
     125     *
     126     *  @since 0.9.30
     127     */
     128    public void reset() throws IOException;
    115129
    116130    /**
  • apps/sam/java/src/net/i2p/sam/MasterSession.java

    rad810de re7cfb2d  
    390390                                        if (!ok) {
    391391                                                _log.logAlways(Log.WARN, "Accept queue overflow for " + ssess);
    392                                                 try { i2ps.close(); } catch (IOException ioe) {}
     392                                                try { i2ps.reset(); } catch (IOException ioe) {}
    393393                                        }
    394394                                } else {
  • apps/sam/java/src/net/i2p/sam/SAMStreamSession.java

    rad810de re7cfb2d  
    565565                    if (id == 0) {
    566566                        _log.error("SAM STREAM session handler not created!");
    567                         i2ps.close();
     567                        i2ps.reset();
    568568                        continue;
    569569                    }
  • apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java

    rad810de re7cfb2d  
    384384                                                                        log.error("SSL error", gse);
    385385                                                                        try {
    386                                                                                 i2ps.close();
     386                                                                                i2ps.reset();
    387387                                                                        } catch (IOException ee) {}
    388388                                                                        throw new RuntimeException("SSL error", gse);
     
    402402                                                log.warn("Error forwarding", ioe);
    403403                                        try {
    404                                                 i2ps.close();
     404                                                i2ps.reset();
    405405                                        } catch (IOException ee) {}
    406406                                        continue;
     
    434434                                        } catch (IOException ee) {}
    435435                                        try {
    436                                                 i2ps.close();
     436                                                i2ps.reset();
    437437                                        } catch (IOException ee) {}
    438438                                        continue ;
  • apps/streaming/java/src/net/i2p/client/streaming/impl/I2PSocketFull.java

    rad810de re7cfb2d  
    6868    }
    6969   
     70    /**
     71     *  Resets and closes this socket. Sends a RESET indication to the far-end.
     72     *  This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket.
     73     *
     74     *  Nonblocking.
     75     *  Any thread currently blocked in an I/O operation upon this socket will throw an IOException.
     76     *  Once a socket has been reset, it is not available for further networking use
     77     *  (i.e. can't be reconnected or rebound). A new socket needs to be created.
     78     *  Resetting this socket will also close the socket's InputStream and OutputStream.
     79     *
     80     *  @since 0.9.30
     81     */
     82    public void reset() throws IOException {
     83        Connection c = _connection;
     84        if (c == null) return;
     85        if (log.shouldLog(Log.INFO))
     86            log.info("reset() called, connected? " + c.getIsConnected() + " : " + c, new Exception());
     87        if (c.getIsConnected()) {
     88            c.disconnect(false);
     89            // this will cause any thread waiting in Connection.packetSendChoke()
     90            // to throw an IOE
     91            c.windowAdjusted();
     92        }
     93        destroy();
     94    }
     95   
    7096    Connection getConnection() { return _connection; }
    7197   
  • history.txt

    rad810de re7cfb2d  
     12017-03-13 zzz
     2 * i2ptunnel:
     3   - Add subsession support to servers
     4   - Reset I2P socket on TCP socket errors
     5 * SAM: Reset I2P socket on handler errors
     6 * Streaming: Add reset() to I2PSocket API
     7
    182017-03-11 zzz
    29Prop from i2p.i2p.zzz.jetty9:
  • router/java/src/net/i2p/router/RouterVersion.java

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