Browse Source

Fix sending trailers when there are data frames in queue

Tony Han 5 years ago
parent
commit
288b8e04d9
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/cow_http2_machine.erl

+ 3 - 3
src/cow_http2_machine.erl

@@ -1184,9 +1184,9 @@ send_or_queue_data(StreamID, State0=#http2_machine{opts=Opts, local_window=ConnW
 		_ ->
 			DataOrFileOrTrailers0
 	end,
-	SendSize = BufferSize + case DataOrFileOrTrailers of
-		{data, D} -> iolist_size(D);
-		#sendfile{bytes=B} -> B;
+	SendSize = case DataOrFileOrTrailers of
+		{data, D} -> BufferSize + iolist_size(D);
+		#sendfile{bytes=B} -> BufferSize + B;
 		{trailers, _} -> 0
 	end,
 	MinSendSize = maps:get(stream_window_data_threshold, Opts, 16384),