From 39c4886fe761cf4cc4f4f137cf3602c9ee616184 Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Sun, 17 Aug 2003 08:22:45 +0000 Subject: * ext/openssl/lib/openssl/ssl.rb (SSLSocket#sync_close=): add a method to specify if the underlying IO will be closed in SSLSocket#close. * ext/openssl/lib/openssl/buffering.rb: add forwarders to setsockopt, getsockopt and fcntl. * ext/openssl/lib/net/protocols.rb: enable sync for SSLSocket. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/lib/net/protocols.rb | 1 + ext/openssl/lib/openssl/buffering.rb | 4 +++- ext/openssl/lib/openssl/ssl.rb | 13 ++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/openssl/lib/net/protocols.rb b/ext/openssl/lib/net/protocols.rb index 5897716f3d..6f646b5785 100644 --- a/ext/openssl/lib/net/protocols.rb +++ b/ext/openssl/lib/net/protocols.rb @@ -42,6 +42,7 @@ module Net def ssl_connect() @raw_socket = @socket @socket = OpenSSL::SSL::SSLSocket.new(@raw_socket, @ssl_context) + @scoket.sync = true @socket.connect end diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb index f07e5bc4c1..6ddec099bf 100644 --- a/ext/openssl/lib/openssl/buffering.rb +++ b/ext/openssl/lib/openssl/buffering.rb @@ -16,7 +16,7 @@ module Buffering include Enumerable - attr_accessor :sync + attr_accessor :sync, :sync_close BLOCK_SIZE = 1024*16 # @@ -185,5 +185,7 @@ module Buffering def close flush sysclose + @sync_close ||= false + @io.close if @sync_close end end diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index e434941913..39d975b1c8 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -29,10 +29,21 @@ module OpenSSL @io.peeraddr end + def getsockopt(level, optname, optval) + @io.setsockopt(level, optname, optval) + end + + def setsockopt(level, optname) + @io.setsockopt(level, optname) + end + + def fcntl(*args) + @io.fcntl(*args) + end + def closed? @io.closed? end end end end - -- cgit v1.2.3