diff options
Diffstat (limited to 'ext/openssl/lib')
-rw-r--r-- | ext/openssl/lib/openssl/ssl.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index 6e6bdfe942..38bf4b7484 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -69,11 +69,16 @@ module OpenSSL def accept sock = @svr.accept - ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx) - ssl.sync = true - ssl.sync_close = true - ssl.accept if @start_immediately - ssl + begin + ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx) + ssl.sync = true + ssl.sync_close = true + ssl.accept if @start_immediately + ssl + rescue SSLError => ex + sock.close + raise ex + end end def close |