documentation build cleaned up
This commit is contained in:
parent
ca8214a2a2
commit
1a88c01f92
13 changed files with 43 additions and 38 deletions
|
|
@ -606,28 +606,31 @@ proc setSockOpt*(socket: Socket, opt: SOBool, value: bool, level = SOL_SOCKET) {
|
|||
var valuei = cint(if value: 1 else: 0)
|
||||
setSockOptInt(socket.fd, cint(level), toCInt(opt), valuei)
|
||||
|
||||
when defined(posix) or defined(nimdoc):
|
||||
when defined(posix) and not defined(nimdoc):
|
||||
proc makeUnixAddr(path: string): Sockaddr_un =
|
||||
result.sun_family = AF_UNIX.toInt
|
||||
if path.len >= Sockaddr_un_path_length:
|
||||
raise newException(ValueError, "socket path too long")
|
||||
copyMem(addr result.sun_path, path.cstring, path.len + 1)
|
||||
|
||||
when defined(posix):
|
||||
proc connectUnix*(socket: Socket, path: string) =
|
||||
## Connects to Unix socket on `path`.
|
||||
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
||||
var socketAddr = makeUnixAddr(path)
|
||||
if socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
|
||||
sizeof(socketAddr).Socklen) != 0'i32:
|
||||
raiseOSError(osLastError())
|
||||
when not defined(nimdoc):
|
||||
var socketAddr = makeUnixAddr(path)
|
||||
if socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
|
||||
sizeof(socketAddr).Socklen) != 0'i32:
|
||||
raiseOSError(osLastError())
|
||||
|
||||
proc bindUnix*(socket: Socket, path: string) =
|
||||
## Binds Unix socket to `path`.
|
||||
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
||||
var socketAddr = makeUnixAddr(path)
|
||||
if socket.fd.bindAddr(cast[ptr SockAddr](addr socketAddr),
|
||||
sizeof(socketAddr).Socklen) != 0'i32:
|
||||
raiseOSError(osLastError())
|
||||
when not defined(nimdoc):
|
||||
var socketAddr = makeUnixAddr(path)
|
||||
if socket.fd.bindAddr(cast[ptr SockAddr](addr socketAddr),
|
||||
sizeof(socketAddr).Socklen) != 0'i32:
|
||||
raiseOSError(osLastError())
|
||||
|
||||
when defined(ssl):
|
||||
proc handshake*(socket: Socket): bool
|
||||
|
|
@ -1399,7 +1402,7 @@ proc connect*(socket: Socket, address: string, port = Port(0),
|
|||
if selectWrite(s, timeout) != 1:
|
||||
raise newException(TimeoutError, "Call to 'connect' timed out.")
|
||||
else:
|
||||
when defineSsl:
|
||||
when defineSsl and not defined(nimdoc):
|
||||
if socket.isSSL:
|
||||
socket.fd.setBlocking(true)
|
||||
{.warning[Deprecated]: off.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue