eventmachine 0.12.10-x86-mswin32-60 → 1.0.0.beta.2-x86-mswin32-60
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 +2 -0
- data/Gemfile +1 -0
- data/README +80 -81
- data/Rakefile +7 -370
- data/docs/COPYING +60 -60
- data/docs/ChangeLog +211 -211
- data/docs/DEFERRABLES +246 -133
- data/docs/EPOLL +141 -141
- data/docs/GNU +281 -281
- data/docs/INSTALL +13 -13
- data/docs/KEYBOARD +42 -38
- data/docs/LEGAL +25 -25
- data/docs/LIGHTWEIGHT_CONCURRENCY +130 -70
- data/docs/PURE_RUBY +75 -75
- data/docs/RELEASE_NOTES +94 -94
- data/docs/SMTP +4 -2
- data/docs/SPAWNED_PROCESSES +148 -89
- data/docs/TODO +8 -8
- data/eventmachine.gemspec +19 -26
- data/examples/ex_channel.rb +42 -42
- data/examples/ex_queue.rb +2 -2
- data/examples/ex_tick_loop_array.rb +15 -0
- data/examples/ex_tick_loop_counter.rb +32 -0
- data/examples/helper.rb +1 -1
- data/ext/binder.cpp +0 -1
- data/ext/cmain.cpp +36 -25
- data/ext/ed.cpp +104 -113
- data/ext/ed.h +24 -30
- data/ext/em.cpp +349 -283
- data/ext/em.h +25 -29
- data/ext/eventmachine.h +5 -4
- data/ext/extconf.rb +58 -49
- data/ext/fastfilereader/extconf.rb +5 -3
- data/ext/fastfilereader/mapper.cpp +214 -214
- data/ext/fastfilereader/mapper.h +59 -59
- data/ext/fastfilereader/rubymain.cpp +127 -127
- data/ext/kb.cpp +1 -3
- data/ext/page.cpp +107 -107
- data/ext/page.h +51 -51
- data/ext/pipe.cpp +9 -11
- data/ext/project.h +12 -8
- data/ext/rubymain.cpp +138 -104
- data/java/.classpath +8 -8
- data/java/.project +17 -17
- data/java/src/com/rubyeventmachine/EmReactor.java +1 -0
- data/java/src/com/rubyeventmachine/EmReactorException.java +40 -40
- data/lib/em/buftok.rb +138 -138
- data/lib/em/callback.rb +25 -25
- data/lib/em/channel.rb +1 -1
- data/lib/em/connection.rb +6 -1
- data/lib/em/deferrable.rb +16 -2
- data/lib/em/file_watch.rb +53 -53
- data/lib/em/future.rb +61 -61
- data/lib/em/iterator.rb +270 -0
- data/lib/em/messages.rb +66 -66
- data/lib/em/process_watch.rb +43 -43
- data/lib/em/protocols.rb +1 -1
- data/lib/em/protocols/header_and_content.rb +138 -138
- data/lib/em/protocols/httpclient.rb +267 -262
- data/lib/em/protocols/line_protocol.rb +28 -0
- data/lib/em/protocols/memcache.rb +322 -322
- data/lib/em/protocols/postgres3.rb +247 -247
- data/lib/em/protocols/saslauth.rb +175 -175
- data/lib/em/protocols/smtpserver.rb +640 -547
- data/lib/em/protocols/stomp.rb +200 -200
- data/lib/em/protocols/tcptest.rb +52 -52
- data/lib/{pr_eventmachine.rb → em/pure_ruby.rb} +1013 -1022
- data/lib/em/queue.rb +1 -0
- data/lib/em/spawnable.rb +85 -85
- data/lib/em/streamer.rb +130 -130
- data/lib/em/tick_loop.rb +85 -0
- data/lib/em/timers.rb +2 -1
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +40 -84
- data/lib/jeventmachine.rb +2 -1
- data/lib/rubyeventmachine.rb +2 -0
- data/setup.rb +1585 -1585
- data/tasks/doc.rake +30 -0
- data/tasks/package.rake +85 -0
- data/tasks/test.rake +6 -0
- data/tests/client.crt +31 -31
- data/tests/client.key +51 -51
- data/tests/test_attach.rb +13 -3
- data/tests/test_basic.rb +60 -95
- data/tests/test_channel.rb +3 -2
- data/tests/test_defer.rb +49 -47
- data/tests/test_deferrable.rb +35 -0
- data/tests/test_error_handler.rb +35 -35
- data/tests/test_errors.rb +82 -82
- data/tests/test_exc.rb +55 -55
- data/tests/test_file_watch.rb +49 -49
- data/tests/test_futures.rb +198 -198
- data/tests/test_handler_check.rb +36 -36
- data/tests/test_hc.rb +190 -218
- data/tests/test_httpclient.rb +227 -218
- data/tests/test_httpclient2.rb +3 -2
- data/tests/test_inactivity_timeout.rb +3 -3
- data/tests/test_kb.rb +60 -60
- data/tests/test_ltp.rb +13 -5
- data/tests/test_ltp2.rb +317 -317
- data/tests/test_next_tick.rb +1 -1
- data/tests/test_object_protocol.rb +36 -36
- data/tests/test_pending_connect_timeout.rb +2 -2
- data/tests/test_process_watch.rb +50 -48
- data/tests/test_proxy_connection.rb +52 -0
- data/tests/test_pure.rb +134 -125
- data/tests/test_queue.rb +44 -44
- data/tests/test_running.rb +42 -42
- data/tests/test_sasl.rb +72 -72
- data/tests/test_send_file.rb +251 -242
- data/tests/test_servers.rb +76 -76
- data/tests/test_smtpclient.rb +83 -83
- data/tests/test_smtpserver.rb +85 -85
- data/tests/test_spawn.rb +322 -322
- data/tests/test_ssl_methods.rb +49 -49
- data/tests/test_ssl_verify.rb +82 -82
- data/tests/test_tick_loop.rb +59 -0
- data/tests/test_timers.rb +13 -15
- data/tests/test_ud.rb +36 -36
- data/tests/testem.rb +31 -31
- metadata +66 -51
- data/ext/cplusplus.cpp +0 -202
- data/ext/emwin.cpp +0 -300
- data/ext/emwin.h +0 -94
- data/ext/epoll.cpp +0 -26
- data/ext/epoll.h +0 -25
- data/ext/eventmachine_cpp.h +0 -96
- data/ext/files.cpp +0 -94
- data/ext/files.h +0 -65
- data/ext/sigs.cpp +0 -89
- data/ext/sigs.h +0 -32
- data/java/src/com/rubyeventmachine/application/Application.java +0 -194
- data/java/src/com/rubyeventmachine/application/Connection.java +0 -74
- data/java/src/com/rubyeventmachine/application/ConnectionFactory.java +0 -37
- data/java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java +0 -46
- data/java/src/com/rubyeventmachine/application/PeriodicTimer.java +0 -38
- data/java/src/com/rubyeventmachine/application/Timer.java +0 -54
- data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +0 -109
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +0 -148
- data/java/src/com/rubyeventmachine/tests/EMTest.java +0 -80
- data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +0 -53
- data/java/src/com/rubyeventmachine/tests/TestServers.java +0 -75
- data/java/src/com/rubyeventmachine/tests/TestTimers.java +0 -90
- data/lib/evma.rb +0 -32
- data/lib/evma/callback.rb +0 -32
- data/lib/evma/container.rb +0 -75
- data/lib/evma/factory.rb +0 -77
- data/lib/evma/protocol.rb +0 -87
- data/lib/evma/reactor.rb +0 -48
- data/web/whatis +0 -7
data/tasks/doc.rake
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
rdoc_task_type = begin
|
2
|
+
require 'rdoc/task'
|
3
|
+
RDoc::Task
|
4
|
+
rescue LoadError
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
Rake::RDocTask
|
7
|
+
end
|
8
|
+
|
9
|
+
df = begin; require 'rdoc/rdoc'; require 'rdoc/generator/darkfish'; true; rescue LoadError; end
|
10
|
+
|
11
|
+
rdtask = rdoc_task_type.new do |rd|
|
12
|
+
rd.title = GEMSPEC.name
|
13
|
+
rd.rdoc_dir = 'rdoc'
|
14
|
+
rd.main = "README"
|
15
|
+
rd.rdoc_files.include("lib/**/*.rb", *GEMSPEC.extra_rdoc_files)
|
16
|
+
rd.rdoc_files.exclude(*%w(lib/em/version lib/emva lib/evma/ lib/pr_eventmachine lib/jeventmachine))
|
17
|
+
rd.template = 'darkfish' if df
|
18
|
+
end
|
19
|
+
|
20
|
+
Rake::Task[:clean].enhance [:clobber_rdoc]
|
21
|
+
|
22
|
+
desc 'Generate and open documentation'
|
23
|
+
task :docs => :rdoc do
|
24
|
+
case RUBY_PLATFORM
|
25
|
+
when /darwin/ ; sh 'open rdoc/index.html'
|
26
|
+
when /mswin|mingw/ ; sh 'start rdoc\index.html'
|
27
|
+
else
|
28
|
+
sh 'firefox rdoc/index.html'
|
29
|
+
end
|
30
|
+
end
|
data/tasks/package.rake
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
require 'rake/extensiontask'
|
3
|
+
require 'rake/javaextensiontask'
|
4
|
+
|
5
|
+
Rake::GemPackageTask.new(GEMSPEC) do |pkg|
|
6
|
+
end
|
7
|
+
|
8
|
+
if RUBY_PLATFORM =~ /java/
|
9
|
+
Rake::JavaExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
|
10
|
+
ext.ext_dir = 'java/src'
|
11
|
+
end
|
12
|
+
else
|
13
|
+
def setup_cross_compilation(ext)
|
14
|
+
unless RUBY_PLATFORM =~ /mswin|mingw/
|
15
|
+
ext.cross_compile = true
|
16
|
+
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
17
|
+
|
18
|
+
# inject 1.8/1.9 pure-ruby entry point
|
19
|
+
ext.cross_compiling do |spec|
|
20
|
+
spec.files += ["lib/#{ext.name}.rb"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
|
26
|
+
ext.ext_dir = 'ext'
|
27
|
+
setup_cross_compilation(ext)
|
28
|
+
end
|
29
|
+
Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
|
30
|
+
ext.ext_dir = 'ext/fastfilereader'
|
31
|
+
setup_cross_compilation(ext)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems
|
36
|
+
%w[ rubyeventmachine fastfilereaderext ].each do |filename|
|
37
|
+
file("lib/#{filename}.rb") do |t|
|
38
|
+
File.open(t.name, 'wb') do |f|
|
39
|
+
f.write <<-eoruby
|
40
|
+
RUBY_VERSION =~ /(\\d+.\\d+)/
|
41
|
+
require "\#{$1}/#{File.basename(t.name, '.rb')}"
|
42
|
+
eoruby
|
43
|
+
end
|
44
|
+
at_exit{ FileUtils.rm t.name if File.exists?(t.name) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
task :cross_cxx do
|
49
|
+
ENV['CROSS_COMPILING'] = 'yes'
|
50
|
+
ENV['CXX'] = 'i386-mingw32-g++'
|
51
|
+
end
|
52
|
+
|
53
|
+
if Rake::Task.task_defined?(:cross)
|
54
|
+
task :cross => 'lib/rubyeventmachine.rb'
|
55
|
+
task :cross => 'lib/fastfilereaderext.rb'
|
56
|
+
task :cross => :cross_cxx
|
57
|
+
end
|
58
|
+
|
59
|
+
def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end
|
60
|
+
def sudo(cmd)
|
61
|
+
if windows? || (require 'etc'; Etc.getpwuid.uid == 0)
|
62
|
+
sh cmd
|
63
|
+
else
|
64
|
+
sh "sudo #{cmd}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
def gem_cmd(action, name, *args)
|
68
|
+
rb = Gem.ruby rescue nil
|
69
|
+
rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']))
|
70
|
+
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
|
71
|
+
end
|
72
|
+
|
73
|
+
Rake::Task[:clean].enhance [:clobber_package]
|
74
|
+
|
75
|
+
namespace :gem do
|
76
|
+
desc 'Install gem (and sudo if required)'
|
77
|
+
task :install => :package do
|
78
|
+
gem_cmd(:install, "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem")
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'Uninstall gem (and sudo if required)'
|
82
|
+
task :uninstall do
|
83
|
+
gem_cmd(:uninstall, "#{GEMSPEC.name}", "-v=#{GEMSPEC.version}")
|
84
|
+
end
|
85
|
+
end
|
data/tasks/test.rake
ADDED
data/tests/client.crt
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIFRDCCAywCAQEwDQYJKoZIhvcNAQEFBQAwaDELMAkGA1UEBhMCRU0xFTATBgNV
|
3
|
-
BAgTDEV2ZW50TWFjaGluZTEVMBMGA1UEChMMRXZlbnRNYWNoaW5lMRQwEgY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|
42
|
+
bIubRGapBoub/AdxMazqoovvT1R9b84kobQfcVAMV6DYh0CVZWyXYfgsV2DSVOiK
|
43
|
+
iufjfoDzg5lLCEI+1XW3/LunrB/W4yPN1X/amf8234ublYyt+2ucD4NUGnP05xLa
|
44
|
+
N6P7M0MwdEEKkvMe0YBBSFH5kWK/dIOjqkgBDes20fVnuuz/tL1dZW7IiIP4dzaV
|
45
|
+
ZGEOwBEatCfqYetv6b/u3IUxDfS7Wg8CggEBALoOwkn5LGdQg+bpdZAKJspGnJWL
|
46
|
+
Kyr9Al2tvgc69rxfpZqS5eDLkYYCzWPpspSt0Axm1O7xOUDQDt42luaLNGJzHZ2Q
|
47
|
+
Hn0ZNMhyHpe8d8mIQngRjD+nuLI/uFUglPzabDOCOln2aycjg1mA6ecXP1XMEVbu
|
48
|
+
0RB/0IE36XTMfZ+u9+TRjkBLpmUaX1FdIQQWfwUou/LfaXotoQlhSGAcprLrncuJ
|
49
|
+
T44UATYEgO/q9pMM33bdE3eBYZHoT9mSvqoLCN4s0LuwOYItIxLKUj0GulL0VQOI
|
50
|
+
SZi+0A1c8cVDXgApkBrWPDQIR9JS4de0gW4hnDoUvHtUc2TYPRnz6N9MtFY=
|
51
|
+
-----END RSA PRIVATE KEY-----
|
data/tests/test_attach.rb
CHANGED
@@ -46,11 +46,21 @@ class TestAttach < Test::Unit::TestCase
|
|
46
46
|
def unbind
|
47
47
|
EM.next_tick do
|
48
48
|
$sock.write("def\n")
|
49
|
-
EM.add_timer(0.
|
49
|
+
EM.add_timer(0.1){ EM.stop }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
def setup
|
55
|
+
$read, $write, $sock, $r, $w, $fd, $sock, $before, $after = nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def teardown
|
59
|
+
[$read, $write, $sock, $r, $w, $fd, $sock, $before, $after].each do |io|
|
60
|
+
io.close rescue nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
54
64
|
def test_attach
|
55
65
|
EM.run{
|
56
66
|
EM.start_server Host, Port, EchoServer
|
@@ -88,8 +98,8 @@ class TestAttach < Test::Unit::TestCase
|
|
88
98
|
def test_set_readable
|
89
99
|
EM.run{
|
90
100
|
$r, $w = IO.pipe
|
91
|
-
c = EM.watch $r, PipeWatch do |
|
92
|
-
|
101
|
+
c = EM.watch $r, PipeWatch do |con|
|
102
|
+
con.notify_readable = false
|
93
103
|
end
|
94
104
|
|
95
105
|
EM.next_tick{
|
data/tests/test_basic.rb
CHANGED
@@ -30,44 +30,17 @@ require 'socket'
|
|
30
30
|
require 'test/unit'
|
31
31
|
|
32
32
|
class TestBasic < Test::Unit::TestCase
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def test_libtype
|
45
|
-
lt = EventMachine.library_type
|
46
|
-
em_lib = (ENV["EVENTMACHINE_LIBRARY"] || $eventmachine_library || :xxx).to_sym
|
47
|
-
|
48
|
-
# Running from test runner, under jruby.
|
49
|
-
if RUBY_PLATFORM == 'java'
|
50
|
-
unless em_lib == :pure_ruby
|
51
|
-
assert_equal( :java, lt )
|
52
|
-
return
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
case em_lib
|
57
|
-
when :pure_ruby
|
58
|
-
assert_equal( :pure_ruby, lt )
|
59
|
-
when :extension
|
60
|
-
assert_equal( :extension, lt )
|
61
|
-
when :java
|
62
|
-
assert_equal( :java, lt )
|
63
|
-
else
|
64
|
-
# Running from jruby as a standalone test.
|
65
|
-
if RUBY_PLATFORM == 'java'
|
66
|
-
assert_equal( :java, lt )
|
67
|
-
else
|
68
|
-
assert_equal( :extension, lt )
|
69
|
-
end
|
70
|
-
end
|
33
|
+
def test_connection_class_cache
|
34
|
+
mod = Module.new
|
35
|
+
a, b = nil, nil
|
36
|
+
EM.run {
|
37
|
+
EM.start_server '127.0.0.1', 9999, mod
|
38
|
+
a = EM.connect '127.0.0.1', 9999, mod
|
39
|
+
b = EM.connect '127.0.0.1', 9999, mod
|
40
|
+
EM.stop
|
41
|
+
}
|
42
|
+
assert_equal a.class, b.class
|
43
|
+
assert_kind_of EM::Connection, a
|
71
44
|
end
|
72
45
|
|
73
46
|
#-------------------------------------
|
@@ -123,20 +96,11 @@ class TestBasic < Test::Unit::TestCase
|
|
123
96
|
assert !EM.reactor_running?
|
124
97
|
end
|
125
98
|
|
126
|
-
|
127
|
-
#--------------------------------------
|
128
|
-
|
129
|
-
# TODO! This is an unfinished edge case.
|
130
|
-
# EM mishandles uncaught Ruby exceptions that fire from within #unbind handlers.
|
131
|
-
# A uncaught Ruby exception results in a call to EM::release_machine (which is in an ensure
|
132
|
-
# block in EM::run). But if EM is processing an unbind request, the release_machine call
|
133
|
-
# will cause a segmentation fault.
|
134
|
-
#
|
135
|
-
|
136
99
|
TestHost = "127.0.0.1"
|
137
100
|
TestPort = 9070
|
138
101
|
|
139
102
|
class UnbindError < EM::Connection
|
103
|
+
ERR = Class.new(StandardError)
|
140
104
|
def initialize *args
|
141
105
|
super
|
142
106
|
end
|
@@ -144,12 +108,12 @@ class TestBasic < Test::Unit::TestCase
|
|
144
108
|
close_connection_after_writing
|
145
109
|
end
|
146
110
|
def unbind
|
147
|
-
raise
|
111
|
+
raise ERR
|
148
112
|
end
|
149
113
|
end
|
150
114
|
|
151
|
-
def
|
152
|
-
assert_raises(
|
115
|
+
def test_unbind_error
|
116
|
+
assert_raises( UnbindError::ERR ) {
|
153
117
|
EM.run {
|
154
118
|
EM.start_server TestHost, TestPort
|
155
119
|
EM.connect TestHost, TestPort, UnbindError
|
@@ -157,47 +121,6 @@ class TestBasic < Test::Unit::TestCase
|
|
157
121
|
}
|
158
122
|
end
|
159
123
|
|
160
|
-
#------------------------------------
|
161
|
-
#
|
162
|
-
# TODO. This is an unfinished bug fix.
|
163
|
-
# This case was originally reported by Dan Aquino. If you throw a Ruby exception
|
164
|
-
# in a post_init handler, it gets rethrown as a confusing reactor exception.
|
165
|
-
# The problem is in eventmachine.rb, which calls post_init within the private
|
166
|
-
# initialize method of the EM::Connection class. This happens in both the EM::connect
|
167
|
-
# method and in the code that responds to connection-accepted events.
|
168
|
-
# What happens is that we instantiate the new connection object, which calls
|
169
|
-
# initialize, and then after initialize returns, we stick the new connection object
|
170
|
-
# into EM's @conns hashtable.
|
171
|
-
# But the problem is that Connection::initialize calls #post_init before it returns,
|
172
|
-
# and this may be user-written code that may throw an uncaught Ruby exception.
|
173
|
-
# If that happens, the reactor will abort, and it will then try to run down open
|
174
|
-
# connections. Because @conns never got a chance to properly reflect the new connection
|
175
|
-
# (because initialize never returned), we throw a ConnectionNotBound error
|
176
|
-
# (eventmachine.rb line 1080).
|
177
|
-
# When the bug is fixed, activate this test case.
|
178
|
-
#
|
179
|
-
|
180
|
-
class PostInitError < EM::Connection
|
181
|
-
def post_init
|
182
|
-
aaa bbb # should produce a Ruby exception
|
183
|
-
end
|
184
|
-
end
|
185
|
-
# This test causes issues, the machine becomes unreleasable after
|
186
|
-
# release_machine suffers an exception in event_callback.
|
187
|
-
def xxx_test_post_init_error
|
188
|
-
assert_raises( EventMachine::ConnectionNotBound ) {
|
189
|
-
EM.run {
|
190
|
-
EM::Timer.new(1) {EM.stop}
|
191
|
-
EM.start_server TestHost, TestPort
|
192
|
-
EM.connect TestHost, TestPort, PostInitError
|
193
|
-
}
|
194
|
-
}
|
195
|
-
EM.run {
|
196
|
-
EM.stop
|
197
|
-
}
|
198
|
-
assert !EM.reactor_running?
|
199
|
-
end
|
200
|
-
|
201
124
|
module BrsTestSrv
|
202
125
|
def receive_data data
|
203
126
|
$received << data
|
@@ -213,6 +136,15 @@ class TestBasic < Test::Unit::TestCase
|
|
213
136
|
end
|
214
137
|
end
|
215
138
|
|
139
|
+
def setup_timeout(timeout = 4)
|
140
|
+
EM.schedule {
|
141
|
+
start_time = EM.current_time
|
142
|
+
EM.add_periodic_timer(0.01) {
|
143
|
+
raise "timeout" if EM.current_time - start_time >= timeout
|
144
|
+
}
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
216
148
|
# From ticket #50
|
217
149
|
def test_byte_range_send
|
218
150
|
$received = ''
|
@@ -221,7 +153,7 @@ class TestBasic < Test::Unit::TestCase
|
|
221
153
|
EM::start_server TestHost, TestPort, BrsTestSrv
|
222
154
|
EM::connect TestHost, TestPort, BrsTestCli
|
223
155
|
|
224
|
-
|
156
|
+
setup_timeout
|
225
157
|
}
|
226
158
|
assert_equal($sent, $received)
|
227
159
|
end
|
@@ -280,5 +212,38 @@ class TestBasic < Test::Unit::TestCase
|
|
280
212
|
}
|
281
213
|
assert_equal(interval, $interval)
|
282
214
|
end
|
283
|
-
|
284
|
-
|
215
|
+
|
216
|
+
module PostInitRaiser
|
217
|
+
ERR = Class.new(StandardError)
|
218
|
+
def post_init
|
219
|
+
raise ERR
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_bubble_errors_from_post_init
|
224
|
+
localhost, port = '127.0.0.1', 9000
|
225
|
+
assert_raises(PostInitRaiser::ERR) do
|
226
|
+
EM.run do
|
227
|
+
EM.start_server localhost, port
|
228
|
+
EM.connect localhost, port, PostInitRaiser
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
module InitializeRaiser
|
234
|
+
ERR = Class.new(StandardError)
|
235
|
+
def initialize
|
236
|
+
raise ERR
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_bubble_errors_from_initialize
|
241
|
+
localhost, port = '127.0.0.1', 9000
|
242
|
+
assert_raises(InitializeRaiser::ERR) do
|
243
|
+
EM.run do
|
244
|
+
EM.start_server localhost, port
|
245
|
+
EM.connect localhost, port, InitializeRaiser
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|