diff options
author | narimiran <narimiran@disroot.org> | 2020-07-06 10:55:51 +0200 |
---|---|---|
committer | narimiran <narimiran@disroot.org> | 2020-07-06 10:55:51 +0200 |
commit | ebaf603c84a569b8de447fdb66bb05124d3a0772 (patch) | |
tree | e8e880dc637f7e8f0f06da4b348b1a59e31220ff /lib/pure/asyncnet.nim | |
parent | 842efab8ae867f001d5043a773ee96a7087c2334 (diff) | |
download | Nim-ebaf603c84a569b8de447fdb66bb05124d3a0772.tar.gz |
revert 0944b0f4
Diffstat (limited to 'lib/pure/asyncnet.nim')
-rw-r--r-- | lib/pure/asyncnet.nim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 410310e29..0bdbeb29b 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -202,7 +202,7 @@ proc newAsyncSocket*(domain, sockType, protocol: cint, when defineSsl: proc getSslError(handle: SslPtr, err: cint): cint = assert err < 0 - var ret = SSL_get_error(handle, err.cint) + var ret = SSLGetError(handle, err.cint) case ret of SSL_ERROR_ZERO_RETURN: raiseSSLError("TLS/SSL connection failed to initiate, socket closed prematurely.") @@ -224,9 +224,9 @@ when defineSsl: let read = bioRead(socket.bioOut, addr data[0], len) assert read != 0 if read < 0: - raiseSSLError() + raiseSslError() data.setLen(read) - await socket.fd.AsyncFD.send(data, flags) + await socket.fd.AsyncFd.send(data, flags) proc appeaseSsl(socket: AsyncSocket, flags: set[SocketFlag], sslError: cint): owned(Future[bool]) {.async.} = @@ -727,7 +727,7 @@ proc close*(socket: AsyncSocket) = if res == 0: discard elif res != 1: - raiseSSLError() + raiseSslError() socket.closed = true # TODO: Add extra debugging checks for this. when defineSsl: @@ -739,12 +739,12 @@ when defineSsl: ## prone to security vulnerabilities. socket.isSsl = true socket.sslContext = ctx - socket.sslHandle = SSL_new(socket.sslContext.context) + socket.sslHandle = SSLNew(socket.sslContext.context) if socket.sslHandle == nil: - raiseSSLError() + raiseSslError() - socket.bioIn = bioNew(bioSMem()) - socket.bioOut = bioNew(bioSMem()) + socket.bioIn = bioNew(bio_s_mem()) + socket.bioOut = bioNew(bio_s_mem()) sslSetBio(socket.sslHandle, socket.bioIn, socket.bioOut) proc wrapConnectedSocket*(ctx: SslContext, socket: AsyncSocket, |