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