Changeset d8c3f61


Ignore:
Timestamp:
Jan 20, 2018 11:34:16 AM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6176aae
Parents:
08dec0e0
Message:

Streaming: Consistent exception message on socket close

Location:
apps/streaming/java/src/net/i2p/client/streaming/impl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java

    r08dec0e0 rd8c3f61  
    204204                    if (getResetReceived())
    205205                        throw new I2PSocketException(I2PSocketException.STATUS_CONNECTION_RESET);
    206                     throw new IOException("disconnected");
     206                    throw new IOException("Socket closed");
    207207                }
    208208                if (_outputStream.getClosed())
    209                     throw new IOException("output stream closed");
     209                    throw new IOException("Output stream closed");
    210210                started = true;
    211211                // Try to keep things moving even during NACKs and retransmissions...
     
    786786        _receiver.destroy();
    787787        _activityTimer.cancel();
    788         _inputStream.streamErrorOccurred(new IOException("disconnected"));
     788        _inputStream.streamErrorOccurred(new IOException("Socket closed"));
    789789       
    790790        if (_log.shouldLog(Log.INFO))
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageInputStream.java

    r08dec0e0 rd8c3f61  
    299299                buf.append(" highest ready block: ").append(_highestReadyBlockId);
    300300               
    301                 _log.debug(buf.toString(), new Exception("closed"));
     301                _log.debug(buf.toString(), new Exception("Input stream closed"));
    302302            }
    303303            _closeReceived = true;
     
    411411            expiration = -1;
    412412        synchronized (_dataLock) {
    413             if (_locallyClosed) throw new IOException("Already locally closed");
     413            if (_locallyClosed) throw new IOException("Input stream closed");
    414414            throwAnyError();
    415415            for (int i = 0; i < length; i++) {
     
    420420                    while (_readyDataBlocks.isEmpty()) {
    421421                        if (_locallyClosed)
    422                             throw new IOException("Already closed");
     422                            throw new IOException("Input stream closed");
    423423                       
    424424                        if ( (_notYetReadyBlocks.isEmpty()) && (_closeReceived) ) {
     
    525525        int numBytes = 0;
    526526        synchronized (_dataLock) {
    527             if (_locallyClosed) throw new IOException("Already closed");
     527            if (_locallyClosed) throw new IOException("Input stream closed");
    528528            throwAnyError();
    529529            for (int i = 0; i < _readyDataBlocks.size(); i++) {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageOutputStream.java

    r08dec0e0 rd8c3f61  
    115115    @Override
    116116    public void write(byte b[], int off, int len) throws IOException {
    117         if (_closed.get()) throw new IOException("Already closed");
     117        if (_closed.get()) throw new IOException("Output stream closed");
    118118        if (_log.shouldLog(Log.DEBUG))
    119119            _log.debug("write(b[], " + off + ", " + len + ") ");
     
    123123        while (remaining > 0) {
    124124            WriteStatus ws = null;
    125             if (_closed.get()) throw new IOException("closed underneath us");
     125            if (_closed.get()) throw new IOException("Output stream closed");
    126126            // we do any waiting outside the synchronized() block because we
    127127            // want to allow other threads to flushAvailable() whenever they want. 
     
    132132                // we only update max size when current buffer is empty
    133133                final int maxBuffer = (_valid == 0) ? locked_updateBufferSize() : _currentBufferSize;
    134                 if (_buf == null) throw new IOException("closed (buffer went away)");
     134                if (_buf == null) throw new IOException("Output stream closed");
    135135                if (_valid + remaining < maxBuffer) {
    136136                    // simply buffer the data, no flush
     
    343343            if (_buf == null) {
    344344                _dataLock.notifyAll();
    345                 throw new IOException("closed (buffer went away)");
     345                throw new IOException("Output stream closed");
    346346            }
    347347
     
    444444        }
    445445        _flusher.cancel();
    446         _streamError.compareAndSet(null,new IOException("Closed internally"));
     446        _streamError.compareAndSet(null, new IOException("Output stream closed"));
    447447        clearData(true);
    448448    }
Note: See TracChangeset for help on using the changeset viewer.