Enable comprehensive reasons when REST server faults to create server. (#5546)

Bump chronos & presto.
This commit is contained in:
Eugene Kabanov 2023-11-01 09:27:43 +02:00 committed by GitHub
parent 556d5e7114
commit 70aaeee704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 21 deletions

View File

@ -356,9 +356,10 @@ proc init*(T: type RestServerRef,
allowedOrigin: Option[string],
validateFn: PatternCallback,
config: AnyConf): T =
let address = initTAddress(ip, port)
let serverFlags = {HttpServerFlags.QueryCommaSeparatedArray,
HttpServerFlags.NotifyDisconnect}
let
address = initTAddress(ip, port)
serverFlags = {HttpServerFlags.QueryCommaSeparatedArray,
HttpServerFlags.NotifyDisconnect}
# We increase default timeout to help validator clients who poll our server
# at least once per slot (12.seconds).
let
@ -370,26 +371,20 @@ proc init*(T: type RestServerRef,
maxHeadersSize = config.restMaxRequestHeadersSize * 1024
maxRequestBodySize = config.restMaxRequestBodySize * 1024
let res = try:
RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout,
maxHeadersSize = maxHeadersSize,
maxRequestBodySize = maxRequestBodySize)
except CatchableError as err:
notice "Rest server could not be started", address = $address,
reason = err.msg
return nil
let res = RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout,
maxHeadersSize = maxHeadersSize,
maxRequestBodySize = maxRequestBodySize,
errorType = string)
if res.isErr():
notice "Rest server could not be started", address = $address,
notice "REST HTTP server could not be started", address = $address,
reason = res.error()
nil
else:
notice "Starting REST HTTP server",
url = "http://" & $ip & ":" & $port & "/"
res.get()
let server = res.get()
notice "Starting REST HTTP server", url = "http://" & $server.localAddress()
server
type
KeymanagerInitResult* = object

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 253bc3cfc079de35f9b96b9934ce702605400a51
Subproject commit be2edab3ac101da03a70cbf52bc3f3d972b35d91

2
vendor/nim-presto vendored

@ -1 +1 @@
Subproject commit 2ae448ff5b0808c8f562c6f0a70bbd7a05407a37
Subproject commit 5ca16485e4d74e531d50d289ebc0f869d9e6352b