From 8ba74e1c904f3a38392d3b76156a5a244c3e3794 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 21 Jun 2016 23:36:22 +0200 Subject: [PATCH] Log when a persistent connection is reused. Use anchor type on `{WGI_STANDALONE_CONNECTOR}.configuration` and `{WSF_STANDALONE_SERVICE_LAUNCHER}.connector`. Add access to the socket of standalone input stream from `{WSF_STANDALONE_CONNECTOR_ACCESS}`. Removed a useless redefination in `WSF_EXECUTION`. --- .../lib/httpd/httpd_request_handler_i.e | 2 ++ .../standalone/src/wgi_standalone_connector.e | 18 ++++++++++++------ .../src/wgi_standalone_connector_access.e | 11 +++++++++++ .../src/wgi_standalone_input_stream.e | 2 +- .../standalone/test_standalone-safe.ecf | 3 +-- .../wsf_standalone_service_launcher.e | 6 +++--- library/server/wsf/src/wsf_execution.e | 1 - 7 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector_access.e diff --git a/library/server/ewsgi/connectors/standalone/lib/httpd/httpd_request_handler_i.e b/library/server/ewsgi/connectors/standalone/lib/httpd/httpd_request_handler_i.e index cb07e103..1c38a3ff 100644 --- a/library/server/ewsgi/connectors/standalone/lib/httpd/httpd_request_handler_i.e +++ b/library/server/ewsgi/connectors/standalone/lib/httpd/httpd_request_handler_i.e @@ -202,6 +202,8 @@ feature -- Execution n := n + 1 if n >= m then is_next_persistent_connection_supported := False + elseif n > 1 and is_verbose then + log ("Reuse connection (" + n.out + ")", information_level) end -- FIXME: it seems to be called one more time, mostly to see this is done. execute_request diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector.e index 56ec6c79..8efd1910 100644 --- a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector.e +++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector.e @@ -1,6 +1,6 @@ note description: "[ - Standalone Web Server connector + Standalone Web Server connector. ]" date: "$Date$" revision: "$Revision$" @@ -20,7 +20,7 @@ feature {NONE} -- Initialization make -- Create current standalone connector. local - fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G] + fac: like request_handler_factory do -- Callbacks create on_launched_actions @@ -51,7 +51,7 @@ feature {NONE} -- Separate helper a_server.set_observer (observer) end - update_factory (conn: detachable separate WGI_STANDALONE_CONNECTOR [G]; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G]; a_conf: separate HTTPD_CONFIGURATION) + update_factory (conn: detachable separate WGI_STANDALONE_CONNECTOR [G]; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G]; a_conf: like configuration) do fac.update_with (conn, a_conf) end @@ -63,11 +63,17 @@ feature {NONE} -- Separate helper feature -- Access - name: STRING_8 = "httpd" + name: STRING_8 -- Name of Current connector + once + Result := "httpd" + end - version: STRING_8 = "0.1" + version: STRING_8 -- Version of Current connector + once + Result := "1.0" + end feature -- Access @@ -238,7 +244,7 @@ feature {NONE} -- Implementation: element change note - copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector_access.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector_access.e new file mode 100644 index 00000000..622cce56 --- /dev/null +++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_connector_access.e @@ -0,0 +1,11 @@ +note + description: "[ + Interface to access protected feature from {WGI_STANDALONE_CONNECTOR}. + ]" + date: "$Date$" + revision: "$Revision$" + +deferred class + WGI_STANDALONE_CONNECTOR_ACCESS + +end diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_input_stream.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_input_stream.e index 2013ad68..0cdcb382 100644 --- a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_input_stream.e +++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_input_stream.e @@ -24,7 +24,7 @@ feature {NONE} -- Initialization set_source (a_source) end -feature {WGI_STANDALONE_CONNECTOR, WGI_SERVICE} -- Nino +feature {WGI_STANDALONE_CONNECTOR, WGI_SERVICE, WGI_STANDALONE_CONNECTOR_ACCESS} -- Standalone set_source (i: like source) do diff --git a/library/server/ewsgi/connectors/standalone/test_standalone-safe.ecf b/library/server/ewsgi/connectors/standalone/test_standalone-safe.ecf index 361d9d80..cfa33896 100644 --- a/library/server/ewsgi/connectors/standalone/test_standalone-safe.ecf +++ b/library/server/ewsgi/connectors/standalone/test_standalone-safe.ecf @@ -10,12 +10,11 @@ - + - diff --git a/library/server/wsf/connector/standalone/wsf_standalone_service_launcher.e b/library/server/wsf/connector/standalone/wsf_standalone_service_launcher.e index 38eda984..3ce801f4 100644 --- a/library/server/wsf/connector/standalone/wsf_standalone_service_launcher.e +++ b/library/server/wsf/connector/standalone/wsf_standalone_service_launcher.e @@ -153,15 +153,15 @@ feature -- Execution feature -- Callback - on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_STANDALONE_CONNECTOR [G]]] + on_launched_actions: ACTION_SEQUENCE [TUPLE [like connector]] -- Actions triggered when launched - on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_STANDALONE_CONNECTOR [G]]] + on_stopped_actions: ACTION_SEQUENCE [TUPLE [like connector]] -- Actions triggered when stopped feature {NONE} -- Implementation - on_launched (conn: WGI_STANDALONE_CONNECTOR [G]) + on_launched (conn: like connector) do on_launched_actions.call ([conn]) end diff --git a/library/server/wsf/src/wsf_execution.e b/library/server/wsf/src/wsf_execution.e index 8bc0a978..352207f7 100644 --- a/library/server/wsf/src/wsf_execution.e +++ b/library/server/wsf/src/wsf_execution.e @@ -14,7 +14,6 @@ inherit make_from_execution as make_from_wgi_execution redefine make, - execute, clean, is_valid_end_of_execution end