use of com.generallycloud.baseio.codec.http2.Http2SocketSession in project baseio by generallycloud.
the class Http2PrefaceFuture method doComplete.
private void doComplete(SocketChannel channel, ByteBuf buf) throws IOException {
Http2SocketSession session = (Http2SocketSession) channel.getSession();
session.setPrefaceRead(false);
if (!isPreface(buf)) {
throw new IOException("not http2 preface");
}
session.doFlush(new DefaultChannelFuture(context, PREFACE_BUF.duplicate()));
}
use of com.generallycloud.baseio.codec.http2.Http2SocketSession in project baseio by generallycloud.
the class Http2HeadersFrameImpl method doComplete.
private void doComplete(SocketChannel channel, ByteBuf buf) throws IOException {
Http2SocketSession session = (Http2SocketSession) channel.getSession();
byte flags = getHeader().getFlags();
this.endStream = (flags & FLAG_END_STREAM) > 0;
if ((flags & FLAG_PADDED) > 0) {
padLength = buf.getByte();
}
if ((flags & FLAG_PRIORITY) > 0) {
streamDependency = buf.getInt();
e = streamDependency < 0;
if (e) {
streamDependency = streamDependency & 0x7FFFFFFF;
}
weight = buf.getUnsignedByte();
}
decoder.decode(streamDependency, buf, session.getHttp2Headers());
}
use of com.generallycloud.baseio.codec.http2.Http2SocketSession in project baseio by generallycloud.
the class Http2SettingsFrameImpl method doComplete.
private void doComplete(SocketChannel channel, ByteBuf buf) throws IOException {
Http2SocketSession session = (Http2SocketSession) channel.getSession();
int settings = buf.limit() / 6;
for (int i = 0; i < settings; i++) {
int key = buf.getShort();
int value = buf.getInt();
session.setSettings(key, value);
}
this.settings = session.getSettings();
channel.flush(this);
}
use of com.generallycloud.baseio.codec.http2.Http2SocketSession in project baseio by generallycloud.
the class Http2ProtocolDecoder method decode.
@Override
public ChannelFuture decode(SocketChannel channel, ByteBuf buffer) throws IOException {
Http2SocketSession http2UnsafeSession = (Http2SocketSession) channel.getSession();
SocketChannelContext context = channel.getContext();
if (http2UnsafeSession.isPrefaceRead()) {
return new Http2PrefaceFuture(context, allocate(channel, PROTOCOL_PREFACE_HEADER));
}
return new Http2FrameHeaderImpl(channel, allocate(channel, PROTOCOL_HEADER));
}
Aggregations