diff options
author | akr <akr@ruby-lang.org> | 2011-10-22 11:35:58 +0000 |
---|---|---|
committer | akr <akr@ruby-lang.org> | 2011-10-22 11:35:58 +0000 |
commit | 167a3577df28d7f27cb1dc7bada64765608bfd7f (patch) | |
tree | 8fac6c866474b2aa956515d304132aaae45d1cd9 /test | |
parent | 5ec5fde7cf24654cb861e89d476950e763063c20 (diff) | |
download | ruby-openssl-history-167a3577df28d7f27cb1dc7bada64765608bfd7f.tar.gz |
* test/openssl/test_ssl.rb (test_multibyte_read_write): start server
for each length to avoid race condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/test_ssl.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/test/test_ssl.rb b/test/test_ssl.rb index ccd94cf..39d9b5e 100644 --- a/test/test_ssl.rb +++ b/test/test_ssl.rb @@ -400,20 +400,18 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase auml = [%w{ C3 A4 }.join('')].pack('H*') auml.force_encoding(Encoding::UTF_8) - str = nil - num_written = nil - - server_proc = Proc.new {|ctx, ssl| - cmp = ssl.read - raw_size = cmp.size - cmp.force_encoding(Encoding::UTF_8) - assert_equal(str, cmp) - assert_equal(num_written, raw_size) - ssl.close - } - - start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port| - [10, 1000, 100000].each {|i| + [10, 1000, 100000].each {|i| + str = nil + num_written = nil + server_proc = Proc.new {|ctx, ssl| + cmp = ssl.read + raw_size = cmp.size + cmp.force_encoding(Encoding::UTF_8) + assert_equal(str, cmp) + assert_equal(num_written, raw_size) + ssl.close + } + start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port| sock = TCPSocket.new("127.0.0.1", port) ssl = OpenSSL::SSL::SSLSocket.new(sock) ssl.sync_close = true |