Changeset 0196275 for core/java


Ignore:
Timestamp:
Feb 22, 2018 2:54:57 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6fe25cd
Parents:
2374471
Message:

Util: Support setSoTimeout() for InternalSockets?
to keep susimail server connections from hanging too long

Location:
core/java/src/net/i2p/util
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/InternalServerSocket.java

    r2374471 r0196275  
    101101        if (iss == null)
    102102             throw new IOException("No server for port: " + port);
    103         PipedInputStream cis = new PipedInputStream(64*1024);
    104         PipedInputStream sis = new PipedInputStream(64*1024);
    105         PipedOutputStream cos = new PipedOutputStream(sis);
    106         PipedOutputStream sos = new PipedOutputStream(cis);
     103        TimeoutPipedInputStream cis = new TimeoutPipedInputStream(64*1024);
     104        TimeoutPipedInputStream sis = new TimeoutPipedInputStream(64*1024);
     105        PipedOutputStream cos = new TimeoutPipedOutputStream(sis);
     106        PipedOutputStream sos = new TimeoutPipedOutputStream(cis);
    107107        clientSock.setInputStream(cis);
    108108        clientSock.setOutputStream(cos);
  • core/java/src/net/i2p/util/InternalSocket.java

    r2374471 r0196275  
    9999    }
    100100
     101    /**
     102     *  Supported as of 0.9.34, if constructed with TimeoutPipedInputStream
     103     *  and TimeoutPipedOutputStream. Otherwise, does nothing.
     104     *  @see TimeoutPipedInputStream
     105     */
     106    @Override
     107    public synchronized void setSoTimeout(int timeout) {
     108        if (_is != null && _is instanceof TimeoutPipedInputStream)
     109            ((TimeoutPipedInputStream) _is).setReadTimeout(timeout);
     110    }
     111
    101112    // ignored stuff
    102     /** warning - unsupported */
    103     @Override
    104     public void setSoTimeout(int timeout) {}
    105 
     113
     114    /**
     115     *  Always returns 0, even if setSoTimeout() was called.
     116     */
    106117    @Override
    107118    public int getSoTimeout () {
Note: See TracChangeset for help on using the changeset viewer.