From 0944b0f4415a262968cf68f1dbb035cfc3326680 Mon Sep 17 00:00:00 2001 From: 3n-k1 <51172302+3n-k1@users.noreply.github.com> Date: Thu, 28 Nov 2019 02:32:11 -0500 Subject: [backport] Fix style issues in lib/, tools/, and testament/. Fixes #12687. (#12754) --- lib/pure/asyncnet.nim | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/pure/asyncnet.nim') diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 2c6cfb056..88852fb84 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -189,7 +189,7 @@ proc newAsyncSocket*(domain, sockType, protocol: cint, when defineSsl: proc getSslError(handle: SslPtr, err: cint): cint = assert err < 0 - var ret = SSLGetError(handle, err.cint) + var ret = SSL_get_error(handle, err.cint) case ret of SSL_ERROR_ZERO_RETURN: raiseSSLError("TLS/SSL connection failed to initiate, socket closed prematurely.") @@ -211,9 +211,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.} = @@ -692,13 +692,13 @@ proc close*(socket: AsyncSocket) = defer: socket.fd.AsyncFD.closeSocket() when defineSsl: - if socket.isSSL: - let res = SslShutdown(socket.sslHandle) - SSLFree(socket.sslHandle) + if socket.isSsl: + let res = SSL_shutdown(socket.sslHandle) + SSL_free(socket.sslHandle) if res == 0: discard elif res != 1: - raiseSslError() + raiseSSLError() socket.closed = true # TODO: Add extra debugging checks for this. when defineSsl: @@ -710,12 +710,12 @@ when defineSsl: ## prone to security vulnerabilities. socket.isSsl = true socket.sslContext = ctx - socket.sslHandle = SSLNew(socket.sslContext.context) + socket.sslHandle = SSL_new(socket.sslContext.context) if socket.sslHandle == nil: - raiseSslError() + raiseSSLError() - socket.bioIn = bioNew(bio_s_mem()) - socket.bioOut = bioNew(bio_s_mem()) + socket.bioIn = bioNew(bioSMem()) + socket.bioOut = bioNew(bioSMem()) sslSetBio(socket.sslHandle, socket.bioIn, socket.bioOut) proc wrapConnectedSocket*(ctx: SslContext, socket: AsyncSocket, -- cgit 1.4.1-2-gfad0