Ejemplo n.º 1
0
  @Override
  public void onFillable() {
    // onFillable means that there are encrypted bytes ready to be filled.
    // however we do not fill them here on this callback, but instead wakeup
    // the decrypted readInterest and/or writeFlusher so that they will attempt
    // to do the fill and/or flush again and these calls will do the actually
    // filling.

    if (DEBUG) LOG.debug("onFillable enter {}", getEndPoint());

    // We have received a close handshake, close the end point to send FIN.
    if (_decryptedEndPoint.isInputShutdown()) getEndPoint().close();

    // wake up whoever is doing the fill or the flush so they can
    // do all the filling, unwrapping, wrapping and flushing
    _decryptedEndPoint.getFillInterest().fillable();

    // If we are handshaking, then wake up any waiting write as well as it may have been blocked on
    // the read
    synchronized (_decryptedEndPoint) {
      if (_decryptedEndPoint._flushRequiresFillToProgress) {
        _decryptedEndPoint._flushRequiresFillToProgress = false;
        getExecutor().execute(_runCompletWrite);
      }
    }

    if (DEBUG) LOG.debug("onFillable exit {}", getEndPoint());
  }
Ejemplo n.º 2
0
  @Override
  public void onFillInterestedFailed(Throwable cause) {
    // this means that the fill interest in encrypted bytes has failed.
    // However we do not handle that here on this callback, but instead wakeup
    // the decrypted readInterest and/or writeFlusher so that they will attempt
    // to do the fill and/or flush again and these calls will do the actually
    // handle the cause.
    _decryptedEndPoint.getFillInterest().onFail(cause);

    boolean failFlusher = false;
    synchronized (_decryptedEndPoint) {
      if (_decryptedEndPoint._flushRequiresFillToProgress) {
        _decryptedEndPoint._flushRequiresFillToProgress = false;
        failFlusher = true;
      }
    }
    if (failFlusher) _decryptedEndPoint.getWriteFlusher().onFail(cause);
  }
Ejemplo n.º 3
0
  @Override
  public String toString() {
    ByteBuffer b = _encryptedInput;
    int ei = b == null ? -1 : b.remaining();
    b = _encryptedOutput;
    int eo = b == null ? -1 : b.remaining();
    b = _decryptedInput;
    int di = b == null ? -1 : b.remaining();

    return String.format(
        "SslConnection@%x{%s,eio=%d/%d,di=%d} -> %s",
        hashCode(),
        _sslEngine.getHandshakeStatus(),
        ei,
        eo,
        di,
        _decryptedEndPoint.getConnection());
  }
Ejemplo n.º 4
0
 @Override
 public void onClose() {
   _decryptedEndPoint.getConnection().onClose();
   super.onClose();
 }
Ejemplo n.º 5
0
 @Override
 public void run() {
   _decryptedEndPoint.getWriteFlusher().completeWrite();
 }