Esempio n. 1
0
 @Override
 public void handlerRemoved0(ChannelHandlerContext ctx) throws Exception {
   if (!pendingUnencryptedWrites.isEmpty()) {
     // Check if queue is not empty first because create a new ChannelException is expensive
     pendingUnencryptedWrites.removeAndFailAll(
         new ChannelException("Pending write on removal of SslHandler"));
   }
 }
Esempio n. 2
0
 @Override
 public void flush(ChannelHandlerContext ctx) throws Exception {
   // Do not encrypt the first write request if this handler is
   // created with startTLS flag turned on.
   if (startTls && !sentFirstMessage) {
     sentFirstMessage = true;
     pendingUnencryptedWrites.removeAndWriteAll();
     ctx.flush();
     return;
   }
   if (pendingUnencryptedWrites.isEmpty()) {
     // It's important to NOT use a voidPromise here as the user
     // may want to add a ChannelFutureListener to the ChannelPromise later.
     //
     // See https://github.com/netty/netty/issues/3364
     pendingUnencryptedWrites.add(Unpooled.EMPTY_BUFFER, ctx.newPromise());
   }
   if (!handshakePromise.isDone()) {
     flushedBeforeHandshake = true;
   }
   wrap(ctx, false);
   ctx.flush();
 }