All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finagle.http2.transport.UpgradeRequestHandler.scala Maven / Gradle / Ivy

There is a newer version: 6.39.0
Show newest version
package com.twitter.finagle.http2.transport

import io.netty.channel.{ChannelInboundHandlerAdapter, ChannelHandlerContext}
import io.netty.handler.codec.http.HttpClientUpgradeHandler.UpgradeEvent

/**
 * Takes the upgrade result and marks it as something read off the wire to
 * expose it to finagle.
 */
private[http2] class UpgradeRequestHandler extends ChannelInboundHandlerAdapter {
  override def userEventTriggered(ctx: ChannelHandlerContext, event: Any): Unit = {
    event match {
      case [email protected]_REJECTED =>
        ctx.fireChannelRead(rejected)
        // disable autoread if we fail the upgrade
        ctx.channel.config.setAutoRead(false)
        ctx.pipeline.remove(this)
      case [email protected]_SUCCESSFUL =>
        ctx.fireChannelRead(successful)
        ctx.pipeline.remove(this)
      case _ => // nop
    }
    super.userEventTriggered(ctx, event)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy