Updated a few classes from http_client to use nanoseconds as timeout precision.

Fixed typo in comments.
This commit is contained in:
2018-02-13 18:46:18 +01:00
parent d3e865cf6c
commit ed3ad962d1
3 changed files with 12 additions and 10 deletions

View File

@@ -157,7 +157,7 @@ feature -- Settings
end end
connect_timeout: INTEGER connect_timeout: INTEGER
-- HTTP connection timeout in seconds. -- HTTP connection timeout in milliseconds.
--| 0 means it nevers timeout --| 0 means it nevers timeout
do do
Result := session.connect_timeout Result := session.connect_timeout
@@ -208,7 +208,7 @@ feature -- Settings
end end
note 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)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -64,7 +64,7 @@ feature {NONE} -- Internal
create Result.make_client_by_port (a_port, a_host) create Result.make_client_by_port (a_port, a_host)
end end
Result.set_connect_timeout (connect_timeout) Result.set_connect_timeout (connect_timeout)
Result.set_timeout (timeout) Result.set_timeout_ns (Result.seconds_to_nanoseconds (timeout))
Result.connect Result.connect
end end
end end
@@ -887,7 +887,7 @@ feature {NONE} -- Helpers
invariant invariant
note 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)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -13,6 +13,8 @@ inherit
HTTPD_SOCKET_FACTORY HTTPD_SOCKET_FACTORY
SOCKET_TIMEOUT_UTILITIES
feature {NONE} -- Initialization feature {NONE} -- Initialization
make (a_request_settings: HTTPD_REQUEST_SETTINGS) 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. -- note: it is relevant only if `is_persistent_connection_supported' is True.
timeout_ns: NATURAL_64 -- nanoseconds 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 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 max_keep_alive_requests: INTEGER
-- Maximum number of requests allowed per persistent connection. -- Maximum number of requests allowed per persistent connection.
keep_alive_timeout_ns: NATURAL_64 -- nanoseconds keep_alive_timeout_ns: NATURAL_64 -- nanoseconds
-- Number of seconds for persistent connection timeout. -- Number of nanoseconds for persistent connection timeout.
feature -- Status report feature -- Status report
@@ -303,13 +305,13 @@ feature -- Execution
end end
-- Try to get request header. -- Try to get request header.
-- If the request is reusing persistent connection, use `keep_alive_timeout', -- If the request is reusing persistent connection, use `keep_alive_timeout_ns',
-- otherwise `socket_recv_timeout'. -- otherwise `socket_recv_timeout_ns'.
get_request_header (l_socket, a_is_reusing_connection) get_request_header (l_socket, a_is_reusing_connection)
if has_error then if has_error then
if a_is_reusing_connection and then request_header.is_empty 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") debug ("dbglog")
dbglog ("execute_request socket=" + l_socket.descriptor.out + "} close persistent connection.") dbglog ("execute_request socket=" + l_socket.descriptor.out + "} close persistent connection.")
end end