use of com.webpieces.http2engine.impl.shared.data.Stream in project webpieces by deanhiller.
the class Level5BResets method sendRstToServerAndApp.
public CompletableFuture<Void> sendRstToServerAndApp(StreamException e) {
RstStreamFrame frame = new RstStreamFrame();
frame.setKnownErrorCode(e.getReason().getErrorCode());
frame.setStreamId(e.getStreamId());
boolean streamExist = streamState.isStreamExist(frame);
if (streamExist) {
Stream stream = streamState.getStream(frame, true);
return fireRstToSocket(stream, frame).thenCompose(v -> {
CompletableFuture<Void> future = fireRstToClient(stream, frame);
return future;
});
} else {
//no stream means idle or closed...
return remoteFlowControl.fireResetToSocket(frame);
}
}
use of com.webpieces.http2engine.impl.shared.data.Stream in project webpieces by deanhiller.
the class StreamState method create.
//client threads
public Stream create(Stream stream) {
int id = stream.getStreamId();
if (id % 2 == 0) {
if (id < highestEvenStream)
throw new IllegalStateException("stream id=" + id + " is too low and must be higher than=" + highestEvenStream);
highestEvenStream = id;
} else {
if (id < highestOddStream)
throw new IllegalStateException("stream id=" + id + " is too low and must be higher than=" + highestOddStream);
highestOddStream = id;
}
Stream oldStream = streamIdToStream.putIfAbsent(id, stream);
if (oldStream == stream)
throw new IllegalStateException("stream id=" + id + " already exists");
return stream;
}
Aggregations