ensure file descriptor is closed
This commit is contained in:
parent
ff24ca9919
commit
1b614ffc80
1 changed files with 15 additions and 13 deletions
|
|
@ -432,6 +432,7 @@ proc accept*(server: Socket, client: var Socket,
|
||||||
|
|
||||||
proc close*(socket: Socket) =
|
proc close*(socket: Socket) =
|
||||||
## Closes a socket.
|
## Closes a socket.
|
||||||
|
try:
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
if socket.isSSL:
|
if socket.isSSL:
|
||||||
ErrClearError()
|
ErrClearError()
|
||||||
|
|
@ -444,6 +445,7 @@ proc close*(socket: Socket) =
|
||||||
discard
|
discard
|
||||||
elif res != 1:
|
elif res != 1:
|
||||||
socketError(socket, res)
|
socketError(socket, res)
|
||||||
|
finally:
|
||||||
socket.fd.close()
|
socket.fd.close()
|
||||||
|
|
||||||
proc toCInt*(opt: SOBool): cint =
|
proc toCInt*(opt: SOBool): cint =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue