From 6612610964cabadfcf408e4223a702555a3570cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 9 Jan 2019 18:12:51 +0100 Subject: Add function gun:stream_info/2 --- src/gun_http2.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gun_http2.erl') diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 9159d78..8072a00 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -24,6 +24,7 @@ -export([request/9]). -export([data/5]). -export([cancel/3]). +-export([stream_info/2]). -export([down/1]). -record(stream, { @@ -371,6 +372,18 @@ cancel(State=#http2_state{socket=Socket, transport=Transport, error_stream_not_found(State, StreamRef, ReplyTo) end. +stream_info(State, StreamRef) -> + case get_stream_by_ref(State, StreamRef) of + #stream{reply_to=ReplyTo} -> + {ok, #{ + ref => StreamRef, + reply_to => ReplyTo, + state => running + }}; + false -> + {ok, undefined} + end. + %% @todo Add unprocessed streams when GOAWAY handling is done. down(#http2_state{streams=Streams}) -> KilledStreams = [Ref || #stream{ref=Ref} <- Streams], -- cgit v1.2.3