Search in sources :

Example 6 with Stream

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);
    }
}
Also used : RstStreamFrame(com.webpieces.http2parser.api.dto.RstStreamFrame) ShutdownStream(com.webpieces.http2engine.api.error.ShutdownStream) Stream(com.webpieces.http2engine.impl.shared.data.Stream)

Example 7 with Stream

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;
}
Also used : Stream(com.webpieces.http2engine.impl.shared.data.Stream)

Aggregations

Stream (com.webpieces.http2engine.impl.shared.data.Stream)7 ShutdownStream (com.webpieces.http2engine.api.error.ShutdownStream)2 Http2Headers (com.webpieces.hpack.api.dto.Http2Headers)1 Http2Push (com.webpieces.hpack.api.dto.Http2Push)1 DataTry (com.webpieces.http2engine.impl.DataTry)1 Http2Event (com.webpieces.http2engine.impl.shared.data.Http2Event)1 Http2SendRecieve (com.webpieces.http2engine.impl.shared.data.Http2Event.Http2SendRecieve)1 RECV_DATA_EOS (com.webpieces.http2engine.impl.shared.data.Http2Event.RECV_DATA_EOS)1 RECV_HEADERS_EOS (com.webpieces.http2engine.impl.shared.data.Http2Event.RECV_HEADERS_EOS)1 RECV_RST (com.webpieces.http2engine.impl.shared.data.Http2Event.RECV_RST)1 SENT_DATA_EOS (com.webpieces.http2engine.impl.shared.data.Http2Event.SENT_DATA_EOS)1 SENT_HEADERS_EOS (com.webpieces.http2engine.impl.shared.data.Http2Event.SENT_HEADERS_EOS)1 SENT_RST (com.webpieces.http2engine.impl.shared.data.Http2Event.SENT_RST)1 Http2PayloadType (com.webpieces.http2engine.impl.shared.data.Http2PayloadType)1 NoTransitionConnectionError (com.webpieces.http2engine.impl.shared.data.NoTransitionConnectionError)1 NoTransitionStreamError (com.webpieces.http2engine.impl.shared.data.NoTransitionStreamError)1 CancelReason (com.webpieces.http2parser.api.dto.CancelReason)1 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)1 RstStreamFrame (com.webpieces.http2parser.api.dto.RstStreamFrame)1 CancelReasonCode (com.webpieces.http2parser.api.dto.error.CancelReasonCode)1