private void handleHttp2Settings(ChannelHandlerContext ctx, Http2Settings h2settings) { if (h2settings.isEmpty()) { logger.trace("{} HTTP/2 settings: <empty>", ctx.channel()); } else { logger.debug("{} HTTP/2 settings: {}", ctx.channel(), h2settings); } if (protocol == H1) { protocol = H2; } else if (protocol == H1C) { protocol = H2C; } final ChannelPipeline pipeline = ctx.pipeline(); final Http2ConnectionHandler handler = pipeline.get(Http2ConnectionHandler.class); if (responseEncoder == null) { responseEncoder = new Http2ObjectEncoder(ctx, handler.encoder()); } else if (responseEncoder instanceof Http1ObjectEncoder) { responseEncoder.close(); responseEncoder = new Http2ObjectEncoder(ctx, handler.encoder()); } // Update the connection-level flow-control window size. final int initialWindow = config.http2InitialConnectionWindowSize(); if (initialWindow > DEFAULT_WINDOW_SIZE) { incrementLocalWindowSize(pipeline, initialWindow - DEFAULT_WINDOW_SIZE); } }
private void handleHttp2Settings(ChannelHandlerContext ctx, Http2Settings h2settings) { if (h2settings.isEmpty()) { logger.finer(MessageFormat.format("{0} HTTP/2 settings: <empty>", ctx.channel())); } else { logger.fine(MessageFormat.format("{0} HTTP/2 settings: {1}", ctx.channel(), h2settings)); } switch (protocol) { case H1: protocol = SessionProtocol.H2; break; case H1C: protocol = SessionProtocol.H2C; break; default: break; } final Http2ConnectionHandler handler = ctx.pipeline().get(Http2ConnectionHandler.class); if (responseEncoder == null) { responseEncoder = new Http2ObjectEncoder(handler.encoder()); } else if (responseEncoder instanceof Http1ObjectEncoder) { responseEncoder.close(); responseEncoder = new Http2ObjectEncoder(handler.encoder()); } }