From 392c4d570aa22118fc1bac3a30cd1087f77e4467 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Thu, 1 Dec 2016 21:05:19 +0100 Subject: [PATCH] Use sendfile functions, only for big files. --- .../standalone/src/wgi_standalone_output_stream.e | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e index 0ec458aa..e8e66371 100644 --- a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e +++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e @@ -99,11 +99,14 @@ feature -- Output put_file_content (a_file: FILE; a_offset: INTEGER; a_byte_count: INTEGER) -- Send `a_byte_count' bytes from the content of file `a_file' starting at offset `a_offset'. - --| Could be redefine for optimization. do - last_target_call_succeed := False - target.put_file_content (a_file, a_offset, a_byte_count) - last_target_call_succeed := not target.was_error + if a_byte_count > 500_000 then + last_target_call_succeed := False + target.put_file_content (a_file, a_offset, a_byte_count) + last_target_call_succeed := not target.was_error + else + Precursor (a_file, a_offset, a_byte_count) + end end feature -- Status report