Added close() to async versions of scgi and httpserver.
This commit is contained in:
parent
bad34033de
commit
15dcb9a6a6
2 changed files with 10 additions and 2 deletions
|
|
@ -499,9 +499,13 @@ proc asyncHTTPServer*(handleRequest: proc (server: PAsyncHTTPServer, client: TSo
|
||||||
result = capturedRet
|
result = capturedRet
|
||||||
|
|
||||||
proc register*(d: PDispatcher, s: PAsyncHTTPServer) =
|
proc register*(d: PDispatcher, s: PAsyncHTTPServer) =
|
||||||
## Registers a PAsyncHTTPServer with a PDispatcher.
|
## Registers a ``PAsyncHTTPServer`` with a ``PDispatcher``.
|
||||||
d.register(s.asyncSocket)
|
d.register(s.asyncSocket)
|
||||||
|
|
||||||
|
proc close*(h: PAsyncHTTPServer) =
|
||||||
|
## Closes the ``PAsyncHTTPServer``.
|
||||||
|
h.asyncSocket.close()
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var counter = 0
|
var counter = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,10 @@ proc register*(d: PDispatcher, s: PAsyncScgiState): PDelegate {.discardable.} =
|
||||||
## Registers ``s`` with dispatcher ``d``.
|
## Registers ``s`` with dispatcher ``d``.
|
||||||
result = d.register(s.asyncServer)
|
result = d.register(s.asyncServer)
|
||||||
|
|
||||||
|
proc close*(s: PAsyncScgiState) =
|
||||||
|
## Closes the ``PAsyncScgiState``.
|
||||||
|
s.asyncServer.close()
|
||||||
|
|
||||||
when false:
|
when false:
|
||||||
var counter = 0
|
var counter = 0
|
||||||
proc handleRequest(client: TSocket, input: string,
|
proc handleRequest(client: TSocket, input: string,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue