Skip to content

Commit 74ce7df

Browse files
committed
Finalizer on SSLStream
1 parent 5447110 commit 74ce7df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ssl.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ mutable struct SSLStream <: IO
400400
bio_read::BIO = BIO(io; finalize=false)
401401
bio_write::BIO = BIO(io; finalize=false)
402402
ssl = SSL(ssl_context, bio_read, bio_write)
403-
return new(ssl, ssl_context, bio_read, bio_write, io, ReentrantLock(), ReentrantLock(), Ref{Csize_t}(0), Ref{Csize_t}(0), Ref{UInt8}(0x00), Ref{Csize_t}(0), false)
403+
x = new(ssl, ssl_context, bio_read, bio_write, io, ReentrantLock(), ReentrantLock(), Ref{Csize_t}(0), Ref{Csize_t}(0), Ref{UInt8}(0x00), Ref{Csize_t}(0), false)
404+
finalizer(close, x)
405+
return x
404406
end
405407
end
406408

0 commit comments

Comments
 (0)