From 98d2d07e07257f23b0ee60d2dafac72379b2cbf1 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Sat, 1 Oct 2016 18:27:41 +0800 Subject: [PATCH] send notification back when received DATA frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s a very simple implement. Check other issues: https://github.com/joedevivo/chatterbox/issues/57 https://github.com/joedevivo/chatterbox/issues/73 --- src/h2_connection.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/h2_connection.erl b/src/h2_connection.erl index 11f0c460..7bf54cf0 100644 --- a/src/h2_connection.erl +++ b/src/h2_connection.erl @@ -1582,5 +1582,15 @@ recv_data(Stream, Frame) -> %% anyway. ok; Pid -> + NotifyPid = h2_stream_set:notify_pid(Stream), + recv_data_cb(NotifyPid, Frame), gen_fsm:send_event(Pid, {recv_data, Frame}) end. + +recv_data_cb(Pid, {#frame_header{ + flags=Flags, + type=?DATA + }, Payload}) -> + Bin = h2_frame_data:data(Payload), + Pid ! {'RECV_DATA', Bin}; +recv_data_cb(_, _) -> ok.