Browse Source

Add cow_http:goaway/2

Loïc Hoguin 8 years ago
parent
commit
5fd9d5e850
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/cow_http2.erl

+ 6 - 0
src/cow_http2.erl

@@ -29,6 +29,7 @@
 -export([push_promise/3]).
 -export([ping/1]).
 -export([ping_ack/1]).
+-export([goaway/3]).
 
 -type streamid() :: pos_integer().
 -type fin() :: fin | nofin.
@@ -356,6 +357,11 @@ ping(Opaque) ->
 ping_ack(Opaque) ->
 	<< 8:24, 6:8, 0:7, 1:1, 0:32, Opaque:64 >>.
 
+goaway(LastStreamID, Reason, DebugData) ->
+	ErrorCode = error_code(Reason),
+	Len = iolist_size(DebugData) + 8,
+	[<< Len:24, 7:8, 0:41, LastStreamID:31, ErrorCode:32 >>, DebugData].
+
 flag_fin(nofin) -> 0;
 flag_fin(fin) -> 1.