asynchttpserver compiles again; made some tests green

This commit is contained in:
Araq 2014-08-13 01:16:18 +02:00
commit 62e454f41b
5 changed files with 19 additions and 19 deletions

View file

View file

@ -184,7 +184,7 @@ proc processClient(client: PAsyncSocket, address: string,
break break
proc serve*(server: PAsyncHttpServer, port: TPort, proc serve*(server: PAsyncHttpServer, port: TPort,
callback: proc (request: TRequest): PFuture[void], callback: proc (request: TRequest): PFuture[void] {.gcsafe.},
address = "") {.async.} = address = "") {.async.} =
## Starts the process of listening for incoming HTTP connections on the ## Starts the process of listening for incoming HTTP connections on the
## specified address and port. ## specified address and port.
@ -207,6 +207,7 @@ proc close*(server: PAsyncHttpServer) =
server.socket.close() server.socket.close()
when isMainModule: when isMainModule:
proc main =
var server = newAsyncHttpServer() var server = newAsyncHttpServer()
proc cb(req: TRequest) {.async.} = proc cb(req: TRequest) {.async.} =
#echo(req.reqMethod, " ", req.url) #echo(req.reqMethod, " ", req.url)
@ -217,3 +218,4 @@ when isMainModule:
asyncCheck server.serve(TPort(5555), cb) asyncCheck server.serve(TPort(5555), cb)
runForever() runForever()
main()

View file

@ -1,11 +1,9 @@
discard """ discard """
output:'''@[23, 45] output:'''@[23, 45]
@[, foo, bar] @[, foo, bar]'''
[, foo, bar]
[23, 45]'''
""" """
echo($(@[23, 45])) echo($(@[23, 45]))
echo($(@["", "foo", "bar"])) echo($(@["", "foo", "bar"]))
echo($(["", "foo", "bar"])) #echo($(["", "foo", "bar"]))
echo($([23, 45])) #echo($([23, 45]))

View file

@ -1,7 +1,7 @@
discard """ discard """
outputsub: "101" outputsub: "101"
msg: "Warning: write to foreign heap" errormsg: "'threadFunc' is not GC-safe"
line: 37 line: 39
cmd: "nimrod $target --hints:on --threads:on $options $file" cmd: "nimrod $target --hints:on --threads:on $options $file"
""" """

View file

@ -1,6 +1,6 @@
discard """ discard """
line: 12 line: 11
errormsg: "write to foreign heap" errormsg: "'horrible' is not GC-safe"
cmd: "nimrod $target --hints:on --threads:on $options $file" cmd: "nimrod $target --hints:on --threads:on $options $file"
""" """