anchor.diff:  %% and terminate the stream if this is the end of it.
   
   %% DATA frame.
  -frame(State=#state{handler=Handler, streams=Streams0}, {data, StreamID, IsFin0, Data}) ->
  -	case lists:keyfind(StreamID, #stream.id, Streams0) of
  +frame(State=#state{handler=Handler, streams=Streams}, {data, StreamID, IsFin0, Data}) ->
  +	case lists:keyfind(StreamID, #stream.id, Streams) of
   		Stream = #stream{state=StreamState0, remote=nofin, body_length=Len0} ->
   			Len = Len0 + byte_size(Data),
   			IsFin = case IsFin0 of
  
positive.code: 	Transport:send(Socket, cow_http2:rst_stream(StreamID, Reason)),
  	stream_terminate(State, StreamID, StreamError).
  
  stream_terminate(State=#state{socket=Socket, transport=Transport,
  		handler=Handler, streams=Streams0, children=Children0}, StreamID, Reason) ->
  	case lists:keytake(StreamID, #stream.id, Streams0) of
  		{value, #stream{state=StreamState, local=nofin}, Streams} when Reason =:= normal ->
  			Transport:send(Socket, cow_http2:data(StreamID, fin, <<>>)),
  			stream_call_terminate(StreamID, Reason, Handler, StreamState),
  
negative.code: 	%% @todo iolist_to_binary(HeaderBlock) isn't optimal. Need a shortcut.
  	State = stream_init(State0#state{server_streamid=PromisedStreamID + 2, encode_state=EncodeState},
  		PromisedStreamID, fin, iolist_to_binary(HeaderBlock)),
  	commands(State, Stream, Tail);
  %% @todo Update the flow control state.
  commands(State, Stream, [{flow, _Size}|Tail]) ->
  	commands(State, Stream, Tail);
  %% Supervise a child process.
  commands(State=#state{children=Children}, Stream=#stream{id=StreamID},
  		[{spawn, Pid, _Shutdown}|Tail]) -> %% @todo Shutdown
  	 commands(State#state{children=[{Pid, StreamID}|Children]}, Stream, Tail);
  %% Error handling.
  commands(State, Stream=#stream{id=StreamID}, [Error = {internal_error, _, _}|_Tail]) ->
  	%% @todo Do we want to run the commands after an internal_error?
  	%% @todo Do we even allow commands after?
  	%% @todo Only reset when the stream still exists.
  	stream_reset(after_commands(State, Stream), StreamID, Error);
  %% Upgrade to a new protocol.
  %%
  %% @todo Implementation.
  %% @todo Can only upgrade if: there are no other streams and there are no children left alive.
  %% @todo For HTTP/1.1 we should reject upgrading if pipelining is used.
  commands(State, Stream, [{upgrade, _Mod, _ModState}]) ->
  	commands(State, Stream, []);
  commands(State, Stream, [{upgrade, _Mod, _ModState}|Tail]) ->
  	%% @todo This is an error. Not sure what to do here yet.
  	commands(State, Stream, Tail);
  commands(State, Stream=#stream{id=StreamID}, [stop|_Tail]) ->
  	%% @todo Do we want to run the commands after a stop?
  	%% @todo Do we even allow commands after?
  	stream_terminate(after_commands(State, Stream), StreamID, normal).
  
  after_commands(State=#state{streams=Streams0}, Stream=#stream{id=StreamID}) ->
  	Streams = lists:keystore(StreamID, #stream.id, Streams0, Stream),
  	State#state{streams=Streams}.
  
  terminate(#state{socket=Socket, transport=Transport, handler=Handler,
  		streams=Streams, children=Children}, Reason) ->
  