mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/lib/openssl/buffering.rb
(OpenSSL::Buffering#write_nonblock): new method. * ext/openssl/ossl_ssl.c (ossl_ssl_write_nonblock): new method. (ossl_ssl_write_internal): defined. (ossl_ssl_write): use ossl_ssl_write_internal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
88db4af385
commit
17a085ea8c
5 changed files with 113 additions and 7 deletions
|
|
@ -165,6 +165,33 @@ class OpenSSL::TestPair < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_write_nonblock
|
||||
ssl_pair {|s1, s2|
|
||||
n = 0
|
||||
begin
|
||||
n += s1.write_nonblock("a" * 100000)
|
||||
n += s1.write_nonblock("b" * 100000)
|
||||
n += s1.write_nonblock("c" * 100000)
|
||||
n += s1.write_nonblock("d" * 100000)
|
||||
n += s1.write_nonblock("e" * 100000)
|
||||
n += s1.write_nonblock("f" * 100000)
|
||||
rescue IO::WaitWritable
|
||||
end
|
||||
s1.close
|
||||
assert_equal(n, s2.read.length)
|
||||
}
|
||||
end
|
||||
|
||||
def test_write_nonblock_with_buffered_data
|
||||
ssl_pair {|s1, s2|
|
||||
s1.write "foo"
|
||||
s1.write_nonblock("bar")
|
||||
s1.write "baz"
|
||||
s1.close
|
||||
assert_equal("foobarbaz", s2.read)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue