bugfix: sockets with SSL support
This commit is contained in:
parent
67d9933eb3
commit
1dfc57c5ff
1 changed files with 5 additions and 4 deletions
|
|
@ -473,7 +473,9 @@ proc acceptAddr*(server: TSocket, client: var TSocket, address: var string) {.
|
||||||
else:
|
else:
|
||||||
SSLError("Unknown error")
|
SSLError("Unknown error")
|
||||||
|
|
||||||
proc setBlocking*(s: TSocket, blocking: bool)
|
proc setBlocking*(s: TSocket, blocking: bool) {.tags: [].}
|
||||||
|
## sets blocking mode on socket
|
||||||
|
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
proc acceptAddrSSL*(server: TSocket, client: var TSocket,
|
proc acceptAddrSSL*(server: TSocket, client: var TSocket,
|
||||||
address: var string): TSSLAcceptResult {.
|
address: var string): TSSLAcceptResult {.
|
||||||
|
|
@ -762,7 +764,7 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0),
|
||||||
socket.sslNoHandshake = true
|
socket.sslNoHandshake = true
|
||||||
|
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
proc handshake*(socket: TSocket): bool {.tags: [FReadIO, RWriteIO].} =
|
proc handshake*(socket: TSocket): bool {.tags: [FReadIO, FWriteIO].} =
|
||||||
## This proc needs to be called on a socket after it connects. This is
|
## This proc needs to be called on a socket after it connects. This is
|
||||||
## only applicable when using ``connectAsync``.
|
## only applicable when using ``connectAsync``.
|
||||||
## This proc performs the SSL handshake.
|
## This proc performs the SSL handshake.
|
||||||
|
|
@ -1394,8 +1396,7 @@ when defined(Windows):
|
||||||
argptr: ptr clong): cint {.
|
argptr: ptr clong): cint {.
|
||||||
stdcall, importc:"ioctlsocket", dynlib: "ws2_32.dll".}
|
stdcall, importc:"ioctlsocket", dynlib: "ws2_32.dll".}
|
||||||
|
|
||||||
proc setBlocking*(s: TSocket, blocking: bool) =
|
proc setBlocking(s: TSocket, blocking: bool) =
|
||||||
## sets blocking mode on socket
|
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
var mode = clong(ord(not blocking)) # 1 for non-blocking, 0 for blocking
|
var mode = clong(ord(not blocking)) # 1 for non-blocking, 0 for blocking
|
||||||
if SOCKET_ERROR == ioctlsocket(TWinSocket(s.fd), FIONBIO, addr(mode)):
|
if SOCKET_ERROR == ioctlsocket(TWinSocket(s.fd), FIONBIO, addr(mode)):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue