asyncnet.nim: Minor code cleanup

This commit is contained in:
Araq
2019-02-15 14:44:27 +01:00
parent 2fae94cdc5
commit 315d438677

View File

@@ -112,7 +112,7 @@ when defineSsl:
type
# TODO: I would prefer to just do:
# AsyncSocket* {.borrow: `.`.} = distinct Socket. But that doesn't work.
AsyncSocketDesc = object
AsyncSocketDesc = object
fd: SocketHandle
closed: bool ## determines whether this socket has been closed
case isBuffered: bool ## determines whether this socket is buffered.
@@ -642,7 +642,7 @@ when defined(posix):
when not defined(nimdoc):
let retFuture = newFuture[void]("connectUnix")
result = retFuture
proc cb(fd: AsyncFD): bool =
let ret = SocketHandle(fd).getSockOptInt(cint(SOL_SOCKET), cint(SO_ERROR))
if ret == 0:
@@ -653,7 +653,7 @@ when defined(posix):
else:
retFuture.fail(newException(OSError, osErrorMsg(OSErrorCode(ret))))
return true
var socketAddr = makeUnixAddr(path)
let ret = socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
(sizeof(socketAddr.sun_family) + path.len).Socklen)
@@ -683,7 +683,7 @@ elif defined(nimdoc):
## Binds Unix socket to `path`.
## This only works on Unix-style systems: Mac OS X, BSD and Linux
discard
proc bindUnix*(socket: AsyncSocket, path: string) =
## Binds Unix socket to `path`.
## This only works on Unix-style systems: Mac OS X, BSD and Linux