summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2017-11-24 16:27:43 +0000
committerDominik Picheta <dominikpicheta@gmail.com>2017-11-24 16:27:43 +0000
commit66d7091b7994b3e5a1d4ede1b50cbf59780c9c16 (patch)
treeeaaf6163ca7c38067e6286cdb50395d7b7de0d30 /lib
parentd6870f2e8957b88e0ebc6b4e3308361862b48524 (diff)
downloadNim-66d7091b7994b3e5a1d4ede1b50cbf59780c9c16.tar.gz
setBlocking(false) is called on AsyncFD in newAsyncSocket proc.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/asyncnet.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim
index 5be457d2a..650bb3340 100644
--- a/lib/pure/asyncnet.nim
+++ b/lib/pure/asyncnet.nim
@@ -140,9 +140,18 @@ proc newAsyncSocket*(fd: AsyncFD, domain: Domain = AF_INET,
     sockType: SockType = SOCK_STREAM,
     protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket =
   ## Creates a new ``AsyncSocket`` based on the supplied params.
+  ##
+  ## The supplied ``fd``'s non-blocking state will be enabled implicitly.
+  ##
+  ## **Note**: This procedure will **NOT** register ``fd`` with the global
+  ## async dispatcher. You need to do this manually. If you have used
+  ## ``newAsyncNativeSocket`` to create ``fd`` then it's already registered.
+  ## The reason for this is that the ``AsyncFD`` type is a special type for an
+  ## FD that signifies that its been registered.
   assert fd != osInvalidSocket.AsyncFD
   new(result)
   result.fd = fd.SocketHandle
+  fd.SocketHandle.setBlocking(false)
   result.isBuffered = buffered
   result.domain = domain
   result.sockType = sockType