Permalink
Browse files

fix stress test

  • Loading branch information...
1 parent d3b342f commit 69ea8792315b6cbb6776428bbd8fbae4d4ad0891 @tmm1 committed Jul 7, 2008
Showing with 15 additions and 15 deletions.
  1. +15 −15 stress_test.rb
View
@@ -8,20 +8,20 @@
EM.epoll
-num.times do |i|
- p i
- users[i] = XMPP4EM::Client.new("test_#{i}@localhost", 'test', :auto_register => true)
- users[i].on(:login) do
- connected += 1
- p ['connected', i, "#{connected} of #{num}"]
-
- if connected == num
- p ['done', Time.now - started]
- exit unless ARGV[1]
+EM.run{
+ num.times do |i|
+ p i
+ users[i] = XMPP4EM::Client.new("test_#{i}@localhost", 'test', :auto_register => true)
+ users[i].on(:login) do
+ connected += 1
+ p ['connected', i, "#{connected} of #{num}"]
+
+ if connected == num
+ p ['done', Time.now - started]
+ EM.stop_event_loop
+ end
end
+
+ users[i].connect('localhost', 5222)
end
-
- users[i].connect
-end
-
-$em_reactor_thread.join
+}

0 comments on commit 69ea879

Please sign in to comment.