Added close() to async versions of scgi and httpserver.

This commit is contained in:
Dominik Picheta
2012-09-23 16:04:17 +01:00
parent bad34033de
commit 15dcb9a6a6
2 changed files with 10 additions and 2 deletions

View File

@@ -499,9 +499,13 @@ proc asyncHTTPServer*(handleRequest: proc (server: PAsyncHTTPServer, client: TSo
result = capturedRet
proc register*(d: PDispatcher, s: PAsyncHTTPServer) =
## Registers a PAsyncHTTPServer with a PDispatcher.
## Registers a ``PAsyncHTTPServer`` with a ``PDispatcher``.
d.register(s.asyncSocket)
proc close*(h: PAsyncHTTPServer) =
## Closes the ``PAsyncHTTPServer``.
h.asyncSocket.close()
when isMainModule:
var counter = 0

View File

@@ -183,6 +183,10 @@ proc register*(d: PDispatcher, s: PAsyncScgiState): PDelegate {.discardable.} =
## Registers ``s`` with dispatcher ``d``.
result = d.register(s.asyncServer)
proc close*(s: PAsyncScgiState) =
## Closes the ``PAsyncScgiState``.
s.asyncServer.close()
when false:
var counter = 0
proc handleRequest(client: TSocket, input: string,