summaryrefslogtreecommitdiff
path: root/ext/openssl/lib/openssl/buffering.rb
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-18 22:49:48 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-18 22:49:48 +0000
commitba64282cdc2e02a742ae5e0159d606051f188aa5 (patch)
treef2a04d9bf6592f11b1d81a233991d4b75b0faeaa /ext/openssl/lib/openssl/buffering.rb
parent40fc7dba9e429b59089a45020245ec61ea4d8086 (diff)
* ext/openssl/ossl_ssl.c: sync_close is moved to SSLSocket as
a builtin. * ext/openssl/lib/openssl/buffering.rb (Buffering#close): ditto. * ext/openssl/lib/openssl/buffering.rb (Buffering#puts): should add a return to the tails of each line. * ext/openssl/lib/openssl/ssl.rb: new class OpenSSL::SSL::SSLServer. * ext/openssl/lib/net/protocols.rb (SSLIO#ssl_connect): use sync_close. * ext/openssl/sample/echo_svr.rb: use SSLServer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib/openssl/buffering.rb')
-rw-r--r--ext/openssl/lib/openssl/buffering.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index 6ddec099bf6..031af4baa34 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, :sync_close
+ attr_accessor :sync
BLOCK_SIZE = 1024*16
#
@@ -158,7 +158,12 @@ module Buffering
def puts(*args)
s = ""
- args.each{ |arg| s << arg.to_s + $/ }
+ args.each{|arg|
+ s << arg.to_s
+ unless /#{$/}\Z/o =~ s
+ s << $/
+ end
+ }
do_write(s)
nil
end
@@ -183,9 +188,7 @@ module Buffering
end
def close
- flush
+ flush rescue nil
sysclose
- @sync_close ||= false
- @io.close if @sync_close
end
end