diff options
Diffstat (limited to 'lib/pure/asyncnet.nim')
-rw-r--r-- | lib/pure/asyncnet.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index c6918517e..72fe51a7e 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -31,7 +31,7 @@ ## ## import asyncnet, asyncdispatch ## -## var clients: seq[AsyncSocket] = @[] +## var clients {.threadvar.}: seq[AsyncSocket] ## ## proc processClient(client: AsyncSocket) {.async.} = ## while true: @@ -40,6 +40,7 @@ ## await c.send(line & "\c\L") ## ## proc serve() {.async.} = +## clients = @[] ## var server = newAsyncSocket() ## server.bindAddr(Port(12345)) ## server.listen() @@ -101,6 +102,10 @@ proc newAsyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, ## Creates a new asynchronous socket. result = newSocket(newAsyncRawSocket(domain, typ, protocol), buffered) +proc newAsyncSocket*(domain, typ, protocol: cint, buffered = true): PAsyncSocket = + ## Creates a new asynchronous socket. + result = newSocket(newAsyncRawSocket(domain, typ, protocol), buffered) + when defined(ssl): proc getSslError(handle: SslPtr, err: cint): cint = assert err < 0 |