diff options
author | Loïc Hoguin <[email protected]> | 2019-01-09 18:12:51 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-01-09 18:12:51 +0100 |
commit | 6612610964cabadfcf408e4223a702555a3570cb (patch) | |
tree | 98598c40aa031aba05ddbe79d5858fc573bb7b5a /src/gun_http2.erl | |
parent | ab4878838fafbd453b41d031c9224b2ee8d2d956 (diff) | |
download | gun-6612610964cabadfcf408e4223a702555a3570cb.tar.gz gun-6612610964cabadfcf408e4223a702555a3570cb.tar.bz2 gun-6612610964cabadfcf408e4223a702555a3570cb.zip |
Add function gun:stream_info/2
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r-- | src/gun_http2.erl | 13 |
1 files changed, 13 insertions, 0 deletions
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], |