allow accept cancellation (#91)

This commit is contained in:
Tanguy Cizain 2021-08-31 16:30:09 +02:00 committed by GitHub
parent 0ec755738c
commit f354dfebe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -190,7 +190,12 @@ proc accept*(server: HttpServer): Future[HttpRequest]
writer: newAsyncStreamWriter(transp)) writer: newAsyncStreamWriter(transp))
trace "Got new request", isTls = server.secure trace "Got new request", isTls = server.secure
try:
return await server.parseRequest(stream) return await server.parseRequest(stream)
except CatchableError as exc:
await stream.closeWait()
raise exc
proc create*( proc create*(
_: typedesc[HttpServer], _: typedesc[HttpServer],