use of io.undertow.server.protocol.http2.Http2ReceiveListener in project undertow by undertow-io.
the class HttpReadListener method doHttp2PriRead.
private boolean doHttp2PriRead(StreamConnection connection, ByteBuffer buffer, HttpServerConnection serverConnection, PooledByteBuffer extraData) throws IOException {
if (buffer.hasRemaining()) {
int res = connection.getSourceChannel().read(buffer);
if (res == -1) {
//fail
return true;
}
if (buffer.hasRemaining()) {
return false;
}
}
buffer.flip();
for (int i = 0; i < PRI_EXPECTED.length; ++i) {
if (buffer.get() != PRI_EXPECTED[i]) {
throw UndertowMessages.MESSAGES.http2PriRequestFailed();
}
}
Http2Channel channel = new Http2Channel(connection, null, serverConnection.getByteBufferPool(), extraData, false, false, false, serverConnection.getUndertowOptions());
Http2ReceiveListener receiveListener = new Http2ReceiveListener(serverConnection.getRootHandler(), serverConnection.getUndertowOptions(), serverConnection.getBufferSize(), null);
channel.getReceiveSetter().set(receiveListener);
channel.resumeReceives();
return true;
}
Aggregations