Changeset 9e18c7e


Ignore:
Timestamp:
Mar 24, 2015 2:33:36 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f3d573c
Parents:
a975dc4
Message:

Streaming: Throw I2PSocketException when connection is reset,
display new error page in HTTP client (ticket #643)
javadocs

Files:
2 added
8 edited

Legend:

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

    ra975dc4 r9e18c7e  
    608608        } else if (status == MessageStatusMessage.STATUS_SEND_FAILURE_UNSUPPORTED_ENCRYPTION) {
    609609            error = usingWWWProxy ? "encp" : "enc";
     610        } else if (status == I2PSocketException.STATUS_CONNECTION_RESET) {
     611            error = usingWWWProxy ? "resetp" : "reset";
    610612        } else {
    611613            error = usingWWWProxy ? "dnfp" : "dnf";
     
    639641    /**
    640642     *  No jump servers
    641      *  @param extraMessage extra message
     643     *  @param extraMessage extra message or null, will be HTML-escaped
    642644     *  @since 0.9.14
    643645     */
     
    650652    /**
    651653     *  @param jumpServers comma- or space-separated list, or null
    652      *  @param extraMessage extra message
     654     *  @param extraMessage extra message or null, will be HTML-escaped
    653655     *  @since 0.9.14
    654656     */
     
    673675            }
    674676            if (extraMessage != null) {
    675                 out.write(("<br><br><b>" + extraMessage + "</b>").getBytes());
     677                out.write(("<br><br><b>" + DataHelper.escapeHTML(extraMessage) + "</b>").getBytes());
    676678            }
    677679            if (jumpServers != null && jumpServers.length() > 0) {
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PServerSocket.java

    ra975dc4 r9e18c7e  
    77
    88/**
    9  * Defines how to listen for streaming peer connections
    10  *
     9 *  Streaming server socket returned by {@link I2PSocketManager#getServerSocket()}.
     10 *  Defines how to listen for streaming peer connections.
     11 *<p>
     12 *  Note that this is not a standard Java {@link java.net.ServerSocket},
     13 *  if you need one of those, use {@link I2PSocketManager#getStandardServerSocket()} instead.
    1114 */
    1215public interface I2PServerSocket {
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java

    ra975dc4 r9e18c7e  
    1010
    1111/**
    12  * Minimalistic adapter between the socket api and I2PTunnel's way.
    13  * Note that this interface is a "subinterface" of the interface
    14  * defined in the "official" streaming api.
     12 *  Streaming socket returned by {@link I2PSocketManager#connect(Destination)}.
     13 *<p>
     14 *  Note that this is not a standard Java {@link java.net.Socket},
     15 *  if you need one of those, use {@link I2PSocketManager#connectToSocket(Destination)} instead.
    1516 */
    1617public interface I2PSocket extends Closeable {
     
    2829     *  As of 0.9.9 will throw an IOE if socket is closed.
    2930     *  Prior to that would return null instead of throwing IOE.
     31     *<p>
     32     *  Note that operations on the returned stream may return an
     33     *  {@link IOException} whose <i>cause</i> as returned by
     34     *  {@link IOException#getCause()} is an {@link I2PSocketException}.
     35     *  If so, the client may retrieve a status code via
     36     *  {@link I2PSocketException#getStatus()} to provide specific feedback to the user.
    3037     *
    3138     * @return an InputStream to read from the socket. Non-null since 0.9.9.
     
    3744     *  As of 0.9.9 will throw an IOE if socket is closed.
    3845     *  Prior to that would return null instead of throwing IOE.
     46     *<p>
     47     *  Note that operations on the returned stream may return an
     48     *  {@link IOException} whose <i>cause</i> as returned by
     49     *  {@link IOException#getCause()} is an {@link I2PSocketException}.
     50     *  If so, the client may retrieve a status code via
     51     *  {@link I2PSocketException#getStatus()} to provide specific feedback to the user.
    3952     *
    4053     * @return an OutputStream to write into the socket. Non-null since 0.9.9.
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketException.java

    ra975dc4 r9e18c7e  
    2121
    2222    /**
    23      *  Use canned message for this status code
     23     *  Router and I2CP status codes are 0 - 511. Start ours at 512.
     24     *  @since 0.9.19
     25     */
     26    public static final int STATUS_CONNECTION_RESET = 512;
     27
     28    /**
     29     *  Use canned message for this status code.
     30     *
     31     *  Standard codes from the router are 0-255, defined in MessageStatusMessage.
     32     *  Standard codes from client-side I2CP are 256-511, defined in SendMessageStatusListener.
     33     *  Standard codes from streaming are 512-767, defined here.
     34     *
    2435     *  @param status >= 0 from MessageStatusMessage or SendMessageStatusListener
    2536     */
     
    106117                return _x("Local destination shutdown");
    107118
     119            case STATUS_CONNECTION_RESET:
     120                return _x("Connection was reset");
     121
    108122            case CUSTOM:
    109123                return super.getMessage();
  • apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java

    ra975dc4 r9e18c7e  
    1313import net.i2p.I2PAppContext;
    1414import net.i2p.client.I2PSession;
     15import net.i2p.client.streaming.I2PSocketException;
    1516import net.i2p.data.DataHelper;
    1617import net.i2p.data.Destination;
     
    607608        if (!_resetReceived.compareAndSet(false, true))
    608609            return;
    609         IOException ioe = new IOException("Reset received");
     610        IOException ioe = new I2PSocketException(I2PSocketException.STATUS_CONNECTION_RESET);
    610611        _outputStream.streamErrorOccurred(ioe);
    611612        _inputStream.streamErrorOccurred(ioe);
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionManager.java

    ra975dc4 r9e18c7e  
    263263                    // This is a tradeoff, because it will keep retransmitting the SYN for a while,
    264264                    // thus more inbound, but let's not spend several KB on the outbound.
    265                     if (_log.shouldLog(Log.INFO))
    266                         _log.info("Dropping RST to " + h);
    267                     return null;
     265                    if (!Boolean.valueOf(_context.getProperty("i2p.streaming.sendResetOnBlock"))) {
     266                        // this is the default. Set property to send reset for debugging.
     267                        if (_log.shouldLog(Log.INFO))
     268                            _log.info("Dropping RST to " + h);
     269                        return null;
     270                    }
    268271                }
    269272            }
  • history.txt

    ra975dc4 r9e18c7e  
     12015-03-24 zzz
     2 * Streaming: Throw I2PSocketException when connection is reset,
     3   display new error page in HTTP client (ticket #643)
     4
     52015-03-23 zzz
     6 * Javadoc: Add missing package.html files (ticket #1109)
     7 * Summary bar: linkify news headings, remove 'show news' link
     8
    192015-03-22 zzz
    210 * Console: Better status feedback on manual reseed from URL
     
    1422
    15232015-03-19 zzz
    16  * Reseed:
     24 * Reseed (ticket #1369):
    1725  - Add form to manually reseed from zip or su3 URL
    1826  - Add form to manually reseed from local zip or su3 file
  • router/java/src/net/i2p/router/RouterVersion.java

    ra975dc4 r9e18c7e  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 10;
     21    public final static long BUILD = 11;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
Note: See TracChangeset for help on using the changeset viewer.