Updated a few classes from http_client to use nanoseconds as timeout precision.
Fixed typo in comments.
This commit is contained in:
@@ -157,7 +157,7 @@ feature -- Settings
|
||||
end
|
||||
|
||||
connect_timeout: INTEGER
|
||||
-- HTTP connection timeout in seconds.
|
||||
-- HTTP connection timeout in milliseconds.
|
||||
--| 0 means it nevers timeout
|
||||
do
|
||||
Result := session.connect_timeout
|
||||
@@ -208,7 +208,7 @@ feature -- Settings
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -64,7 +64,7 @@ feature {NONE} -- Internal
|
||||
create Result.make_client_by_port (a_port, a_host)
|
||||
end
|
||||
Result.set_connect_timeout (connect_timeout)
|
||||
Result.set_timeout (timeout)
|
||||
Result.set_timeout_ns (Result.seconds_to_nanoseconds (timeout))
|
||||
Result.connect
|
||||
end
|
||||
end
|
||||
@@ -887,7 +887,7 @@ feature {NONE} -- Helpers
|
||||
|
||||
invariant
|
||||
note
|
||||
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -13,6 +13,8 @@ inherit
|
||||
|
||||
HTTPD_SOCKET_FACTORY
|
||||
|
||||
SOCKET_TIMEOUT_UTILITIES
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_request_settings: HTTPD_REQUEST_SETTINGS)
|
||||
@@ -149,16 +151,16 @@ feature -- Settings
|
||||
-- note: it is relevant only if `is_persistent_connection_supported' is True.
|
||||
|
||||
timeout_ns: NATURAL_64 -- nanoseconds
|
||||
-- Amount of seconds that the server waits for receipts and transmissions during communications.
|
||||
-- Amount of nanoseconds that the server waits for receipts and transmissions during communications.
|
||||
|
||||
socket_recv_timeout_ns: NATURAL_64 -- nanoseconds
|
||||
-- Amount of seconds that the server waits for receiving data on socket during communications.
|
||||
-- Amount of nanoseconds that the server waits for receiving data on socket during communications.
|
||||
|
||||
max_keep_alive_requests: INTEGER
|
||||
-- Maximum number of requests allowed per persistent connection.
|
||||
|
||||
keep_alive_timeout_ns: NATURAL_64 -- nanoseconds
|
||||
-- Number of seconds for persistent connection timeout.
|
||||
-- Number of nanoseconds for persistent connection timeout.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
@@ -303,13 +305,13 @@ feature -- Execution
|
||||
end
|
||||
|
||||
-- Try to get request header.
|
||||
-- If the request is reusing persistent connection, use `keep_alive_timeout',
|
||||
-- otherwise `socket_recv_timeout'.
|
||||
-- If the request is reusing persistent connection, use `keep_alive_timeout_ns',
|
||||
-- otherwise `socket_recv_timeout_ns'.
|
||||
get_request_header (l_socket, a_is_reusing_connection)
|
||||
|
||||
if has_error then
|
||||
if a_is_reusing_connection and then request_header.is_empty then
|
||||
-- Close persistent connection, since no new connection occurred in the delay `keep_alive_timeout'.
|
||||
-- Close persistent connection, since no new connection occurred in the delay `keep_alive_timeout_ns'.
|
||||
debug ("dbglog")
|
||||
dbglog ("execute_request socket=" + l_socket.descriptor.out + "} close persistent connection.")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user