Using passive regions.
Improve connector options mainly for standalone connector. Updated "simple" example to return a timestamp.
This commit is contained in:
@@ -23,8 +23,8 @@ feature {NONE} -- Initialization
|
||||
local
|
||||
n: INTEGER
|
||||
p: like pool
|
||||
do
|
||||
n := max_concurrent_connections (server)
|
||||
do
|
||||
n := max_concurrent_connections (server).max (1) -- At least one processor!
|
||||
create p.make (n)
|
||||
initialize_pool (p, n)
|
||||
pool := p
|
||||
|
||||
@@ -23,7 +23,7 @@ feature {NONE} -- Initialization
|
||||
local
|
||||
n: INTEGER
|
||||
do
|
||||
n := max_concurrent_connections (server)
|
||||
n := max_concurrent_connections (server).max (1) -- At least one thread!
|
||||
create pool.make (n.to_natural_32)
|
||||
end
|
||||
|
||||
|
||||
@@ -34,9 +34,10 @@ feature -- Access
|
||||
max_concurrent_connections: INTEGER assign set_max_concurrent_connections
|
||||
socket_accept_timeout: INTEGER assign set_socket_accept_timeout
|
||||
socket_connect_timeout: INTEGER assign set_socket_connect_timeout
|
||||
|
||||
force_single_threaded: BOOLEAN assign set_force_single_threaded
|
||||
do
|
||||
Result := (max_concurrent_connections = 0)
|
||||
Result := max_concurrent_connections = 0
|
||||
end
|
||||
|
||||
is_verbose: BOOLEAN assign set_is_verbose
|
||||
@@ -126,6 +127,10 @@ feature -- Element change
|
||||
end
|
||||
|
||||
set_force_single_threaded (v: like force_single_threaded)
|
||||
-- Force server to handle incoming request in a single thread.
|
||||
-- i.e set max_concurrent_connections to 0!
|
||||
obsolete
|
||||
"Use set_max_concurrent_connections (0) [June/2016]"
|
||||
do
|
||||
if v then
|
||||
set_max_concurrent_connections (0)
|
||||
|
||||
@@ -14,6 +14,7 @@ feature {NONE} -- Initialization
|
||||
make
|
||||
do
|
||||
reset
|
||||
persistent_connection_timeout := 5 -- seconds
|
||||
end
|
||||
|
||||
reset
|
||||
@@ -114,7 +115,7 @@ feature -- Settings
|
||||
Result := {HTTPD_SERVER}.is_persistent_connection_supported
|
||||
end
|
||||
|
||||
persistent_connection_timeout: INTEGER = 5 -- seconds
|
||||
persistent_connection_timeout: INTEGER -- seconds
|
||||
-- Number of seconds for persistent connection timeout.
|
||||
-- Default: 5 sec.
|
||||
|
||||
@@ -210,17 +211,8 @@ feature -- Execution
|
||||
|
||||
--| TODO: add configuration options for socket timeout.
|
||||
--| set by default 5 seconds.
|
||||
-- l_socket.set_timeout (persistent_connection_timeout) -- 5 seconds!
|
||||
l_socket.set_timeout (1) -- 1 second!
|
||||
from
|
||||
i := persistent_connection_timeout -- * 1 sec
|
||||
until
|
||||
l_is_ready or i <= 0 or has_error
|
||||
loop
|
||||
l_is_ready := l_socket.ready_for_reading
|
||||
check not l_socket.is_closed end
|
||||
i := i - 1
|
||||
end
|
||||
l_socket.set_timeout (persistent_connection_timeout) -- 5 seconds!
|
||||
l_is_ready := l_socket.ready_for_reading
|
||||
|
||||
if l_is_ready then
|
||||
create l_remote_info
|
||||
|
||||
@@ -37,7 +37,7 @@ feature {NONE} -- Initialization
|
||||
build_controller
|
||||
-- Build `controller'.
|
||||
do
|
||||
create controller
|
||||
create <NONE> controller
|
||||
end
|
||||
|
||||
initialize
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Implementation of WGI request handler factory for WGI_STANDALOE_CONNECTOR."
|
||||
description: "Implementation of WGI request handler factory for WGI_STANDALONE_CONNECTOR."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -16,7 +16,7 @@ feature -- Access
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_connector (conn: like connector)
|
||||
update_with (conn: like connector)
|
||||
-- Set `connector' with `conn'.
|
||||
do
|
||||
connector := conn
|
||||
|
||||
@@ -26,9 +26,9 @@ feature {NONE} -- Initialization
|
||||
create on_launched_actions
|
||||
|
||||
-- Server
|
||||
create fac
|
||||
create <NONE> fac
|
||||
create server.make (fac)
|
||||
create observer
|
||||
create <NONE> observer
|
||||
configuration := server_configuration (server)
|
||||
controller := server_controller (server)
|
||||
set_factory_connector (Current, fac)
|
||||
@@ -53,7 +53,7 @@ feature {NONE} -- Separate helper
|
||||
|
||||
set_factory_connector (conn: detachable separate WGI_STANDALONE_CONNECTOR [G]; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G])
|
||||
do
|
||||
fac.set_connector (conn)
|
||||
fac.update_with (conn)
|
||||
end
|
||||
|
||||
server_configuration (a_server: like server): like configuration
|
||||
|
||||
Reference in New Issue
Block a user