aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_spdy.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-04-09 23:13:57 +0300
committerLoïc Hoguin <[email protected]>2015-04-09 23:13:57 +0300
commita738db07c2040461f0fd431f04ecf90b157ead5b (patch)
tree3435489b45067c80fc7b7620cf02622676811c24 /src/gun_spdy.erl
parent2badb594bdedfd1283306fe2075c2c51abdd600d (diff)
downloadgun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.gz
gun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.bz2
gun-a738db07c2040461f0fd431f04ecf90b157ead5b.zip
Add gun_up and gun_down messages
The flush(Pid) function was enhanced to also discard Websocket messages and the new up/down messages.
Diffstat (limited to 'src/gun_spdy.erl')
-rw-r--r--src/gun_spdy.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gun_spdy.erl b/src/gun_spdy.erl
index 6aeb517..c417e78 100644
--- a/src/gun_spdy.erl
+++ b/src/gun_spdy.erl
@@ -15,6 +15,7 @@
-module(gun_spdy).
-export([check_options/1]).
+-export([name/0]).
-export([init/4]).
-export([handle/2]).
-export([close/1]).
@@ -23,6 +24,7 @@
-export([request/8]).
-export([data/4]).
-export([cancel/2]).
+-export([down/1]).
-record(stream, {
id :: non_neg_integer(),
@@ -52,6 +54,8 @@ do_check_options([{keepalive, K}|Opts]) when is_integer(K), K > 0 ->
do_check_options([Opt|_]) ->
{error, {options, {spdy, Opt}}}.
+name() -> spdy.
+
init(Owner, Socket, Transport, _Opts) ->
#spdy_state{owner=Owner, socket=Socket, transport=Transport,
zdef=cow_spdy:deflate_init(), zinf=cow_spdy:inflate_init()}.
@@ -263,6 +267,11 @@ cancel(State=#spdy_state{socket=Socket, transport=Transport},
error_stream_not_found(State)
end.
+%% @todo Add unprocessed streams when GOAWAY handling is done.
+down(#spdy_state{streams=Streams}) ->
+ KilledStreams = [Ref || #stream{ref=Ref} <- Streams],
+ {KilledStreams, []}.
+
error_stream_closed(State=#spdy_state{owner=Owner}) ->
Owner ! {gun_error, self(), {badstate,
"The stream has already been closed."}},