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) =
|
||||
## Closes a socket.
|
||||
try:
|
||||
when defined(ssl):
|
||||
if socket.isSSL:
|
||||
ErrClearError()
|
||||
|
|
@ -444,6 +445,7 @@ proc close*(socket: Socket) =
|
|||
discard
|
||||
elif res != 1:
|
||||
socketError(socket, res)
|
||||
finally:
|
||||
socket.fd.close()
|
||||
|
||||
proc toCInt*(opt: SOBool): cint =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue