1 /* 2 * Copyright 2016 The Netty Project 3 * 4 * The Netty Project licenses this file to you under the Apache License, 5 * version 2.0 (the "License"); you may not use this file except in compliance 6 * with the License. You may obtain a copy of the License at: 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 package io.netty.handler.codec.http2; 17 18 import io.netty.buffer.ByteBuf; 19 import io.netty.buffer.ByteBufHolder; 20 import io.netty.util.internal.UnstableApi; 21 22 /** 23 * HTTP/2 GOAWAY frame. 24 * 25 * <p>The last stream identifier <em>must not</em> be set by the application, but instead the 26 * relative {@link #extraStreamIds()} should be used. The {@link #lastStreamId()} will only be 27 * set for incoming GOAWAY frames by the HTTP/2 codec. 28 * 29 * <p>Graceful shutdown as described in the HTTP/2 spec can be accomplished by calling 30 * {@code #setExtraStreamIds(Integer.MAX_VALUE)}. 31 */ 32 @UnstableApi 33 public interface Http2GoAwayFrame extends Http2Frame, ByteBufHolder { 34 /** 35 * The reason for beginning closure of the connection. Represented as an HTTP/2 error code. 36 */ 37 long errorCode(); 38 39 /** 40 * The number of IDs to reserve for the receiver to use while GOAWAY is in transit. This allows 41 * for new streams currently en route to still be created, up to a point, which allows for very 42 * graceful shutdown of both sides. 43 */ 44 int extraStreamIds(); 45 46 /** 47 * Sets the number of IDs to reserve for the receiver to use while GOAWAY is in transit. 48 * 49 * @see #extraStreamIds 50 * @return {@code this} 51 */ 52 Http2GoAwayFrame setExtraStreamIds(int extraStreamIds); 53 54 /** 55 * Returns the last stream identifier if set, or {@code -1} else. 56 */ 57 int lastStreamId(); 58 59 /** 60 * Optional debugging information describing cause the GOAWAY. Will not be {@code null}, but may 61 * be empty. 62 */ 63 @Override 64 ByteBuf content(); 65 66 @Override 67 Http2GoAwayFrame copy(); 68 69 @Override 70 Http2GoAwayFrame duplicate(); 71 72 @Override 73 Http2GoAwayFrame retainedDuplicate(); 74 75 @Override 76 Http2GoAwayFrame replace(ByteBuf content); 77 78 @Override 79 Http2GoAwayFrame retain(); 80 81 @Override 82 Http2GoAwayFrame retain(int increment); 83 84 @Override 85 Http2GoAwayFrame touch(); 86 87 @Override 88 Http2GoAwayFrame touch(Object hint); 89 }