setBlocking(false) is called on AsyncFD in newAsyncSocket proc.
This commit is contained in:
parent
d6870f2e89
commit
66d7091b79
2 changed files with 11 additions and 1 deletions
|
|
@ -12,7 +12,8 @@
|
||||||
`getBool`, `getFloat`, `getBiggestInt`. Also `getInt` procedure was added.
|
`getBool`, `getFloat`, `getBiggestInt`. Also `getInt` procedure was added.
|
||||||
- `reExtended` is no longer default for the `re` constructor in the `re`
|
- `reExtended` is no longer default for the `re` constructor in the `re`
|
||||||
module.
|
module.
|
||||||
|
- `newAsyncSocket` taking an `AsyncFD` now runs `setBlocking(false)` on the
|
||||||
|
fd.
|
||||||
|
|
||||||
### Library changes
|
### Library changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,9 +140,18 @@ proc newAsyncSocket*(fd: AsyncFD, domain: Domain = AF_INET,
|
||||||
sockType: SockType = SOCK_STREAM,
|
sockType: SockType = SOCK_STREAM,
|
||||||
protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket =
|
protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket =
|
||||||
## Creates a new ``AsyncSocket`` based on the supplied params.
|
## 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
|
assert fd != osInvalidSocket.AsyncFD
|
||||||
new(result)
|
new(result)
|
||||||
result.fd = fd.SocketHandle
|
result.fd = fd.SocketHandle
|
||||||
|
fd.SocketHandle.setBlocking(false)
|
||||||
result.isBuffered = buffered
|
result.isBuffered = buffered
|
||||||
result.domain = domain
|
result.domain = domain
|
||||||
result.sockType = sockType
|
result.sockType = sockType
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue