diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-22 06:22:48 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-22 06:22:48 +0000 |
commit | afdc0c9b1ce68c051239f0a5215cfdbd217b28fa (patch) | |
tree | 887afbbe8f9e77e408fd501550b07d2f523a4d66 /test | |
parent | 7b64d3ef3496d14bc8040d00e63cf2bef6133ecd (diff) | |
download | unicorn-afdc0c9b1ce68c051239f0a5215cfdbd217b28fa.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@727 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'test')
-rw-r--r-- | test/test_ws.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/test_ws.rb b/test/test_ws.rb index 5ea5a16..33981c6 100644 --- a/test/test_ws.rb +++ b/test/test_ws.rb @@ -45,22 +45,21 @@ class WebServerTest < Test::Unit::TestCase def do_test(string, chunk, close_after=nil) - @socket = TCPSocket.new("127.0.0.1", 9998); + # Do not use instance variables here, because it needs to be thread safe + socket = TCPSocket.new("127.0.0.1", 9998); request = StringIO.new(string) chunks_out = 0 -# STDERR.puts chunks_out while data = request.read(chunk) - chunks_out += @socket.write(data) -# STDERR.puts chunks_out - @socket.flush + chunks_out += socket.write(data) + socket.flush sleep 0.2 if close_after and chunks_out > close_after - @socket.close + socket.close sleep 1 end end - @socket.write(" ") # Some platforms only raise the exception on attempted write + socket.write(" ") # Some platforms only raise the exception on attempted write end def test_trickle_attack |