eventmachine 1.0.0.beta.2-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +16 -0
- data/Gemfile +1 -0
- data/README +81 -0
- data/Rakefile +11 -0
- data/docs/COPYING +60 -0
- data/docs/ChangeLog +211 -0
- data/docs/DEFERRABLES +246 -0
- data/docs/EPOLL +141 -0
- data/docs/GNU +281 -0
- data/docs/INSTALL +13 -0
- data/docs/KEYBOARD +42 -0
- data/docs/LEGAL +25 -0
- data/docs/LIGHTWEIGHT_CONCURRENCY +130 -0
- data/docs/PURE_RUBY +75 -0
- data/docs/RELEASE_NOTES +94 -0
- data/docs/SMTP +4 -0
- data/docs/SPAWNED_PROCESSES +148 -0
- data/docs/TODO +8 -0
- data/eventmachine.gemspec +33 -0
- data/examples/ex_channel.rb +43 -0
- data/examples/ex_queue.rb +2 -0
- data/examples/ex_tick_loop_array.rb +15 -0
- data/examples/ex_tick_loop_counter.rb +32 -0
- data/examples/helper.rb +2 -0
- data/ext/binder.cpp +124 -0
- data/ext/binder.h +46 -0
- data/ext/cmain.cpp +838 -0
- data/ext/ed.cpp +1884 -0
- data/ext/ed.h +418 -0
- data/ext/em.cpp +2348 -0
- data/ext/em.h +228 -0
- data/ext/eventmachine.h +123 -0
- data/ext/extconf.rb +157 -0
- data/ext/fastfilereader/extconf.rb +85 -0
- data/ext/fastfilereader/mapper.cpp +214 -0
- data/ext/fastfilereader/mapper.h +59 -0
- data/ext/fastfilereader/rubymain.cpp +127 -0
- data/ext/kb.cpp +79 -0
- data/ext/page.cpp +107 -0
- data/ext/page.h +51 -0
- data/ext/pipe.cpp +347 -0
- data/ext/project.h +155 -0
- data/ext/rubymain.cpp +1200 -0
- data/ext/ssl.cpp +460 -0
- data/ext/ssl.h +94 -0
- data/java/.classpath +8 -0
- data/java/.project +17 -0
- data/java/src/com/rubyeventmachine/EmReactor.java +571 -0
- data/java/src/com/rubyeventmachine/EmReactorException.java +40 -0
- data/java/src/com/rubyeventmachine/EventableChannel.java +69 -0
- data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -0
- data/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -0
- data/lib/em/buftok.rb +138 -0
- data/lib/em/callback.rb +26 -0
- data/lib/em/channel.rb +57 -0
- data/lib/em/connection.rb +569 -0
- data/lib/em/deferrable.rb +206 -0
- data/lib/em/file_watch.rb +54 -0
- data/lib/em/future.rb +61 -0
- data/lib/em/iterator.rb +270 -0
- data/lib/em/messages.rb +66 -0
- data/lib/em/process_watch.rb +44 -0
- data/lib/em/processes.rb +119 -0
- data/lib/em/protocols.rb +36 -0
- data/lib/em/protocols/header_and_content.rb +138 -0
- data/lib/em/protocols/httpclient.rb +268 -0
- data/lib/em/protocols/httpclient2.rb +590 -0
- data/lib/em/protocols/line_and_text.rb +125 -0
- data/lib/em/protocols/line_protocol.rb +28 -0
- data/lib/em/protocols/linetext2.rb +161 -0
- data/lib/em/protocols/memcache.rb +323 -0
- data/lib/em/protocols/object_protocol.rb +45 -0
- data/lib/em/protocols/postgres3.rb +247 -0
- data/lib/em/protocols/saslauth.rb +175 -0
- data/lib/em/protocols/smtpclient.rb +357 -0
- data/lib/em/protocols/smtpserver.rb +640 -0
- data/lib/em/protocols/socks4.rb +66 -0
- data/lib/em/protocols/stomp.rb +200 -0
- data/lib/em/protocols/tcptest.rb +53 -0
- data/lib/em/pure_ruby.rb +1013 -0
- data/lib/em/queue.rb +62 -0
- data/lib/em/spawnable.rb +85 -0
- data/lib/em/streamer.rb +130 -0
- data/lib/em/tick_loop.rb +85 -0
- data/lib/em/timers.rb +57 -0
- data/lib/em/version.rb +3 -0
- data/lib/eventmachine.rb +1548 -0
- data/lib/jeventmachine.rb +258 -0
- data/lib/rubyeventmachine.rb +2 -0
- data/setup.rb +1585 -0
- data/tasks/cpp.rake_example +77 -0
- data/tasks/doc.rake +30 -0
- data/tasks/package.rake +85 -0
- data/tasks/test.rake +6 -0
- data/tests/client.crt +31 -0
- data/tests/client.key +51 -0
- data/tests/test_attach.rb +136 -0
- data/tests/test_basic.rb +249 -0
- data/tests/test_channel.rb +64 -0
- data/tests/test_connection_count.rb +35 -0
- data/tests/test_defer.rb +49 -0
- data/tests/test_deferrable.rb +35 -0
- data/tests/test_epoll.rb +160 -0
- data/tests/test_error_handler.rb +35 -0
- data/tests/test_errors.rb +82 -0
- data/tests/test_exc.rb +55 -0
- data/tests/test_file_watch.rb +49 -0
- data/tests/test_futures.rb +198 -0
- data/tests/test_get_sock_opt.rb +30 -0
- data/tests/test_handler_check.rb +37 -0
- data/tests/test_hc.rb +190 -0
- data/tests/test_httpclient.rb +227 -0
- data/tests/test_httpclient2.rb +154 -0
- data/tests/test_inactivity_timeout.rb +50 -0
- data/tests/test_kb.rb +60 -0
- data/tests/test_ltp.rb +190 -0
- data/tests/test_ltp2.rb +317 -0
- data/tests/test_next_tick.rb +133 -0
- data/tests/test_object_protocol.rb +37 -0
- data/tests/test_pause.rb +70 -0
- data/tests/test_pending_connect_timeout.rb +48 -0
- data/tests/test_process_watch.rb +50 -0
- data/tests/test_processes.rb +128 -0
- data/tests/test_proxy_connection.rb +144 -0
- data/tests/test_pure.rb +134 -0
- data/tests/test_queue.rb +44 -0
- data/tests/test_running.rb +42 -0
- data/tests/test_sasl.rb +72 -0
- data/tests/test_send_file.rb +251 -0
- data/tests/test_servers.rb +76 -0
- data/tests/test_smtpclient.rb +83 -0
- data/tests/test_smtpserver.rb +85 -0
- data/tests/test_spawn.rb +322 -0
- data/tests/test_ssl_args.rb +79 -0
- data/tests/test_ssl_methods.rb +50 -0
- data/tests/test_ssl_verify.rb +82 -0
- data/tests/test_tick_loop.rb +59 -0
- data/tests/test_timers.rb +160 -0
- data/tests/test_ud.rb +36 -0
- data/tests/testem.rb +31 -0
- metadata +240 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
5
|
+
require "eventmachine"
|
6
|
+
|
7
|
+
module EventMachine
|
8
|
+
def self._set_mocks
|
9
|
+
class <<self
|
10
|
+
alias set_tls_parms_old set_tls_parms
|
11
|
+
alias start_tls_old start_tls
|
12
|
+
begin
|
13
|
+
old, $VERBOSE = $VERBOSE, nil
|
14
|
+
def set_tls_parms *args; end
|
15
|
+
def start_tls *args; end
|
16
|
+
ensure
|
17
|
+
$VERBOSE = old
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self._clear_mocks
|
23
|
+
class <<self
|
24
|
+
begin
|
25
|
+
old, $VERBOSE = $VERBOSE, nil
|
26
|
+
alias set_tls_parms set_tls_parms_old
|
27
|
+
alias start_tls start_tls_old
|
28
|
+
ensure
|
29
|
+
$VERBOSE = old
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
class TestSslArgs < Test::Unit::TestCase
|
38
|
+
def setup
|
39
|
+
EventMachine._set_mocks
|
40
|
+
end
|
41
|
+
|
42
|
+
def teardown
|
43
|
+
EventMachine._clear_mocks
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_tls_params_file_doesnt_exist
|
47
|
+
priv_file, cert_file = 'foo_priv_key', 'bar_cert_file'
|
48
|
+
[priv_file, cert_file].all? do |f|
|
49
|
+
assert(!File.exists?(f), "Cert file #{f} seems to exist, and should not for the tests")
|
50
|
+
end
|
51
|
+
|
52
|
+
# associate_callback_target is a pain! (build!)
|
53
|
+
conn = EventMachine::Connection.new('foo')
|
54
|
+
|
55
|
+
assert_raises(EventMachine::FileNotFoundException) do
|
56
|
+
conn.start_tls(:private_key_file => priv_file)
|
57
|
+
end
|
58
|
+
assert_raises(EventMachine::FileNotFoundException) do
|
59
|
+
conn.start_tls(:cert_chain_file => cert_file)
|
60
|
+
end
|
61
|
+
assert_raises(EventMachine::FileNotFoundException) do
|
62
|
+
conn.start_tls(:private_key_file => priv_file, :cert_chain_file => cert_file)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_tls_params_file_does_exist
|
67
|
+
priv_file = Tempfile.new('em_test')
|
68
|
+
cert_file = Tempfile.new('em_test')
|
69
|
+
priv_file_path = priv_file.path
|
70
|
+
cert_file_path = cert_file.path
|
71
|
+
conn = EventMachine::Connection.new('foo')
|
72
|
+
params = {:private_key_file => priv_file_path, :cert_chain_file => cert_file_path}
|
73
|
+
begin
|
74
|
+
conn.start_tls params
|
75
|
+
rescue Object
|
76
|
+
assert(false, 'should not have raised an exception')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end if EM.ssl?
|
@@ -0,0 +1,50 @@
|
|
1
|
+
$:.unshift "../lib"
|
2
|
+
require 'eventmachine'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class TestSSLMethods < Test::Unit::TestCase
|
6
|
+
|
7
|
+
module ServerHandler
|
8
|
+
|
9
|
+
def post_init
|
10
|
+
start_tls
|
11
|
+
end
|
12
|
+
|
13
|
+
def ssl_handshake_completed
|
14
|
+
$server_called_back = true
|
15
|
+
$server_cert_value = get_peer_cert
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClientHandler
|
21
|
+
|
22
|
+
def post_init
|
23
|
+
start_tls
|
24
|
+
end
|
25
|
+
|
26
|
+
def ssl_handshake_completed
|
27
|
+
$client_called_back = true
|
28
|
+
$client_cert_value = get_peer_cert
|
29
|
+
EM.stop_event_loop
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_ssl_methods
|
35
|
+
$server_called_back, $client_called_back = false, false
|
36
|
+
$server_cert_value, $client_cert_value = nil, nil
|
37
|
+
|
38
|
+
EM.run {
|
39
|
+
EM.start_server("127.0.0.1", 9999, ServerHandler)
|
40
|
+
EM.connect("127.0.0.1", 9999, ClientHandler)
|
41
|
+
}
|
42
|
+
|
43
|
+
assert($server_called_back)
|
44
|
+
assert($client_called_back)
|
45
|
+
|
46
|
+
assert($server_cert_value.is_a?(NilClass))
|
47
|
+
assert($client_cert_value.is_a?(String))
|
48
|
+
end
|
49
|
+
|
50
|
+
end if EM.ssl?
|
@@ -0,0 +1,82 @@
|
|
1
|
+
$:.unshift "../lib"
|
2
|
+
require 'eventmachine'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class TestSslVerify < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
$dir = File.dirname(File.expand_path(__FILE__)) + '/'
|
9
|
+
$cert_from_file = File.read($dir+'client.crt')
|
10
|
+
end
|
11
|
+
|
12
|
+
module Client
|
13
|
+
def connection_completed
|
14
|
+
start_tls(:private_key_file => $dir+'client.key', :cert_chain_file => $dir+'client.crt')
|
15
|
+
end
|
16
|
+
|
17
|
+
def ssl_handshake_completed
|
18
|
+
$client_handshake_completed = true
|
19
|
+
close_connection
|
20
|
+
end
|
21
|
+
|
22
|
+
def unbind
|
23
|
+
EM.stop_event_loop
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module AcceptServer
|
28
|
+
def post_init
|
29
|
+
start_tls(:verify_peer => true)
|
30
|
+
end
|
31
|
+
|
32
|
+
def ssl_verify_peer(cert)
|
33
|
+
$cert_from_server = cert
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
def ssl_handshake_completed
|
38
|
+
$server_handshake_completed = true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module DenyServer
|
43
|
+
def post_init
|
44
|
+
start_tls(:verify_peer => true)
|
45
|
+
end
|
46
|
+
|
47
|
+
def ssl_verify_peer(cert)
|
48
|
+
$cert_from_server = cert
|
49
|
+
# Do not accept the peer. This should now cause the connection to shut down without the SSL handshake being completed.
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
def ssl_handshake_completed
|
54
|
+
$server_handshake_completed = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_accept_server
|
59
|
+
$client_handshake_completed, $server_handshake_completed = false, false
|
60
|
+
EM.run {
|
61
|
+
EM.start_server("127.0.0.1", 16784, AcceptServer)
|
62
|
+
EM.connect("127.0.0.1", 16784, Client).instance_variable_get("@signature")
|
63
|
+
}
|
64
|
+
|
65
|
+
assert_equal($cert_from_file, $cert_from_server)
|
66
|
+
assert($client_handshake_completed)
|
67
|
+
assert($server_handshake_completed)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_deny_server
|
71
|
+
$client_handshake_completed, $server_handshake_completed = false, false
|
72
|
+
EM.run {
|
73
|
+
EM.start_server("127.0.0.1", 16784, DenyServer)
|
74
|
+
EM.connect("127.0.0.1", 16784, Client)
|
75
|
+
}
|
76
|
+
|
77
|
+
assert_equal($cert_from_file, $cert_from_server)
|
78
|
+
assert(!$client_handshake_completed)
|
79
|
+
assert(!$server_handshake_completed)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "eventmachine"
|
3
|
+
|
4
|
+
class TestEmTickLoop < Test::Unit::TestCase
|
5
|
+
def test_em_tick_loop
|
6
|
+
i = 0
|
7
|
+
EM.tick_loop { i += 1; EM.stop if i == 10 }
|
8
|
+
EM.run { EM.add_timer(1) { EM.stop } }
|
9
|
+
assert_equal i, 10
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_tick_loop_on_stop
|
13
|
+
t = nil
|
14
|
+
tick_loop = EM.tick_loop { :stop }
|
15
|
+
tick_loop.on_stop { t = true }
|
16
|
+
EM.run { EM.next_tick { EM.stop } }
|
17
|
+
assert t
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_start_twice
|
21
|
+
i = 0
|
22
|
+
s = 0
|
23
|
+
tick_loop = EM.tick_loop { i += 1; :stop }
|
24
|
+
tick_loop.on_stop { s += 1; EM.stop }
|
25
|
+
EM.run { EM.next_tick { EM.stop } }
|
26
|
+
assert_equal 1, i
|
27
|
+
assert_equal 1, s
|
28
|
+
tick_loop.start
|
29
|
+
EM.run { EM.next_tick { EM.stop } }
|
30
|
+
assert_equal 2, i
|
31
|
+
assert_equal 1, s # stop callbacks are only called once
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_stop
|
35
|
+
i, s = 0, 0
|
36
|
+
tick_loop = EM.tick_loop { i += 1 }
|
37
|
+
tick_loop.on_stop { s += 1 }
|
38
|
+
EM.run { EM.next_tick { tick_loop.stop; EM.next_tick { EM.stop } } }
|
39
|
+
assert tick_loop.stopped?
|
40
|
+
assert_equal 1, i
|
41
|
+
assert_equal 1, s
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_immediate_stops
|
45
|
+
s = 0
|
46
|
+
tick_loop = EM::TickLoop.new { }
|
47
|
+
tick_loop.on_stop { s += 1 }
|
48
|
+
tick_loop.on_stop { s += 1 }
|
49
|
+
assert_equal 2, s
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_stopped
|
53
|
+
tick_loop = EM::TickLoop.new { }
|
54
|
+
assert tick_loop.stopped?
|
55
|
+
tick_loop.start
|
56
|
+
assert !tick_loop.stopped?
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# $Id$
|
2
|
+
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 8 April 2006
|
6
|
+
#
|
7
|
+
# See EventMachine and EventMachine::Connection for documentation and
|
8
|
+
# usage examples.
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
21
|
+
#
|
22
|
+
#---------------------------------------------------------------------------
|
23
|
+
#
|
24
|
+
#
|
25
|
+
#
|
26
|
+
#
|
27
|
+
|
28
|
+
$:.unshift "../lib"
|
29
|
+
require 'eventmachine'
|
30
|
+
require 'test/unit'
|
31
|
+
|
32
|
+
class TestTimers < Test::Unit::TestCase
|
33
|
+
|
34
|
+
def test_timer_with_block
|
35
|
+
x = false
|
36
|
+
EventMachine.run {
|
37
|
+
EventMachine::Timer.new(0.25) {
|
38
|
+
x = true
|
39
|
+
EventMachine.stop
|
40
|
+
}
|
41
|
+
}
|
42
|
+
assert x
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_timer_with_proc
|
46
|
+
x = false
|
47
|
+
EventMachine.run {
|
48
|
+
EventMachine::Timer.new(0.25, proc {
|
49
|
+
x = true
|
50
|
+
EventMachine.stop
|
51
|
+
})
|
52
|
+
}
|
53
|
+
assert x
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_timer_cancel
|
57
|
+
x = true
|
58
|
+
EventMachine.run {
|
59
|
+
timer = EventMachine::Timer.new(0.25, proc { x = false })
|
60
|
+
timer.cancel
|
61
|
+
EventMachine::Timer.new(0.5, proc {EventMachine.stop})
|
62
|
+
}
|
63
|
+
assert x
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_periodic_timer
|
67
|
+
x = 0
|
68
|
+
EventMachine.run {
|
69
|
+
EventMachine::PeriodicTimer.new(0.1) do
|
70
|
+
x += 1
|
71
|
+
EventMachine.stop if x == 4
|
72
|
+
end
|
73
|
+
}
|
74
|
+
assert( x == 4 )
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_add_periodic_timer
|
78
|
+
x = 0
|
79
|
+
EM.run {
|
80
|
+
t = EM.add_periodic_timer(0.1) do
|
81
|
+
x += 1
|
82
|
+
EM.stop if x == 4
|
83
|
+
end
|
84
|
+
assert t.respond_to?(:cancel)
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_periodic_timer_cancel
|
89
|
+
x = 0
|
90
|
+
EventMachine.run {
|
91
|
+
pt = EventMachine::PeriodicTimer.new(0.25, proc { x += 1 })
|
92
|
+
pt.cancel
|
93
|
+
EventMachine::Timer.new(0.5) {EventMachine.stop}
|
94
|
+
}
|
95
|
+
assert( x == 0 )
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_add_periodic_timer_cancel
|
99
|
+
x = 0
|
100
|
+
EventMachine.run {
|
101
|
+
pt = EM.add_periodic_timer(0.1) { x += 1 }
|
102
|
+
EM.cancel_timer(pt)
|
103
|
+
EM.add_timer(0.2) { EM.stop }
|
104
|
+
}
|
105
|
+
assert( x == 0 )
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_periodic_timer_self_cancel
|
109
|
+
x = 0
|
110
|
+
EventMachine.run {
|
111
|
+
pt = EventMachine::PeriodicTimer.new(0.1) {
|
112
|
+
x += 1
|
113
|
+
if x == 4
|
114
|
+
pt.cancel
|
115
|
+
EventMachine.stop
|
116
|
+
end
|
117
|
+
}
|
118
|
+
}
|
119
|
+
assert( x == 4 )
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
# This test is only applicable to compiled versions of the reactor.
|
124
|
+
# Pure ruby and java versions have no built-in limit on the number of outstanding timers.
|
125
|
+
#
|
126
|
+
def test_timer_change_max_outstanding
|
127
|
+
defaults = EM.get_max_timers
|
128
|
+
EM.set_max_timers(100)
|
129
|
+
|
130
|
+
one_hundred_one_timers = proc { 101.times { EM.add_timer(5) {} } }
|
131
|
+
|
132
|
+
EM.run {
|
133
|
+
if EM.library_type == :pure_ruby
|
134
|
+
one_hundred_one_timers.call
|
135
|
+
elsif EM.library_type == :java
|
136
|
+
one_hundred_one_timers.call
|
137
|
+
else
|
138
|
+
begin
|
139
|
+
assert_raises( RuntimeError ) {
|
140
|
+
one_hundred_one_timers.call
|
141
|
+
}
|
142
|
+
rescue Object
|
143
|
+
p $!
|
144
|
+
assert(false, $!.message)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
EM.stop
|
148
|
+
}
|
149
|
+
|
150
|
+
EM.set_max_timers( 101 )
|
151
|
+
|
152
|
+
EM.run {
|
153
|
+
one_hundred_one_timers.call
|
154
|
+
EM.stop
|
155
|
+
}
|
156
|
+
ensure
|
157
|
+
EM.set_max_timers(defaults)
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
data/tests/test_ud.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# $Id$
|
2
|
+
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 8 April 2006
|
6
|
+
#
|
7
|
+
# See EventMachine and EventMachine::Connection for documentation and
|
8
|
+
# usage examples.
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
21
|
+
#
|
22
|
+
#---------------------------------------------------------------------------
|
23
|
+
#
|
24
|
+
#
|
25
|
+
#
|
26
|
+
|
27
|
+
$:.unshift "../lib"
|
28
|
+
require 'eventmachine'
|
29
|
+
require 'test/unit'
|
30
|
+
|
31
|
+
class TestUserDefinedEvents < Test::Unit::TestCase
|
32
|
+
|
33
|
+
def test_a
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|