eventmachine 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/ext/ed.cpp +3 -2
- data/ext/em.cpp +12 -6
- data/ext/em.h +1 -1
- data/ext/extconf.rb +1 -1
- data/ext/rubymain.cpp +8 -1
- data/lib/em/protocols/httpclient.rb +1 -0
- data/lib/em/version.rb +1 -1
- data/lib/jeventmachine.rb +2 -2
- data/tests/test_basic.rb +1 -1
- data/tests/test_connection_count.rb +31 -2
- data/tests/test_file_watch.rb +19 -0
- data/tests/test_httpclient.rb +33 -28
- data/tests/test_httpclient2.rb +26 -26
- data/tests/test_idle_connection.rb +24 -18
- data/tests/test_ipv4.rb +70 -100
- data/tests/test_ipv6.rb +0 -26
- data/tests/test_iterator.rb +19 -16
- data/tests/test_ltp.rb +28 -11
- data/tests/test_pending_connect_timeout.rb +3 -3
- data/tests/test_resolver.rb +4 -3
- data/tests/test_sock_opt.rb +54 -0
- data/tests/test_stomp.rb +11 -10
- data/tests/test_unbind_reason.rb +14 -26
- metadata +4 -6
- data/tests/test_get_sock_opt.rb +0 -37
- data/tests/test_set_sock_opt.rb +0 -39
data/tests/test_resolver.rb
CHANGED
@@ -20,7 +20,7 @@ class TestResolver < Test::Unit::TestCase
|
|
20
20
|
pend('FIXME: this test is broken on Windows') if windows?
|
21
21
|
|
22
22
|
EM.run {
|
23
|
-
d = EM::DNS::Resolver.resolve "
|
23
|
+
d = EM::DNS::Resolver.resolve "example.com"
|
24
24
|
d.errback { assert false }
|
25
25
|
d.callback { |r|
|
26
26
|
assert r
|
@@ -45,6 +45,7 @@ class TestResolver < Test::Unit::TestCase
|
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
48
|
+
# There isn't a public DNS entry like 'example.com' with an A rrset
|
48
49
|
def test_a_pair
|
49
50
|
pend('FIXME: this test is broken on Windows') if windows?
|
50
51
|
|
@@ -78,8 +79,8 @@ class TestResolver < Test::Unit::TestCase
|
|
78
79
|
pend('FIXME: this test is broken on Windows') if windows?
|
79
80
|
|
80
81
|
EM.run {
|
81
|
-
d = EM::DNS::Resolver.resolve "
|
82
|
-
d.errback { |err| assert false, "failed to resolve
|
82
|
+
d = EM::DNS::Resolver.resolve "example.com"
|
83
|
+
d.errback { |err| assert false, "failed to resolve example.com: #{err}" }
|
83
84
|
d.callback { |r|
|
84
85
|
# This isn't a great test, but it's hard to get more canonical
|
85
86
|
# confirmation that the timer is cancelled
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'em_test_helper'
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
class TestSockOpt < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
assert(!EM.reactor_running?)
|
7
|
+
@port = next_port
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
assert(!EM.reactor_running?)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_set_sock_opt
|
15
|
+
omit_if(windows?)
|
16
|
+
omit_if(!EM.respond_to?(:set_sock_opt))
|
17
|
+
|
18
|
+
val = nil
|
19
|
+
test_module = Module.new do
|
20
|
+
define_method :post_init do
|
21
|
+
val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true
|
22
|
+
EM.stop
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
EM.run do
|
27
|
+
EM.start_server '127.0.0.1', @port
|
28
|
+
EM.connect '127.0.0.1', @port, test_module
|
29
|
+
end
|
30
|
+
|
31
|
+
assert_equal 0, val
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_get_sock_opt
|
35
|
+
omit_if(windows?)
|
36
|
+
omit_if(!EM.respond_to?(:set_sock_opt))
|
37
|
+
|
38
|
+
val = nil
|
39
|
+
test_module = Module.new do
|
40
|
+
define_method :connection_completed do
|
41
|
+
val = get_sock_opt Socket::SOL_SOCKET, Socket::SO_ERROR
|
42
|
+
EM.stop
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
EM.run do
|
47
|
+
EM.start_server '127.0.0.1', @port
|
48
|
+
EM.connect '127.0.0.1', @port, test_module
|
49
|
+
end
|
50
|
+
|
51
|
+
assert_equal "\0\0\0\0", val
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/tests/test_stomp.rb
CHANGED
@@ -9,19 +9,20 @@ class TestStomp < Test::Unit::TestCase
|
|
9
9
|
size || str.size
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
connection.instance_eval do
|
15
|
-
extend EM::P::Stomp
|
12
|
+
class TStomp
|
13
|
+
include EM::P::Stomp
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def last_sent_content_length
|
16
|
+
@sent && Integer(@sent[CONTENT_LENGTH_REGEX, 1])
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
19
|
+
def send_data(string)
|
20
|
+
@sent = string
|
24
21
|
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_content_length_in_bytes
|
25
|
+
connection = TStomp.new
|
25
26
|
|
26
27
|
queue = "queue"
|
27
28
|
failure_message = "header content-length is not the byte size of last sent body"
|
data/tests/test_unbind_reason.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'em_test_helper'
|
2
|
-
require 'socket'
|
3
2
|
|
4
3
|
class TestUnbindReason < Test::Unit::TestCase
|
5
4
|
|
@@ -11,42 +10,31 @@ class TestUnbindReason < Test::Unit::TestCase
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
13
|
+
# RFC 5737 Address Blocks Reserved for Documentation
|
14
14
|
def test_connect_timeout
|
15
|
-
|
16
|
-
EM.run
|
17
|
-
conn = EM.connect '
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
}
|
23
|
-
conn.pending_connect_timeout = TIMEOUT_INTERVAL
|
24
|
-
}
|
25
|
-
assert_equal Errno::ETIMEDOUT, error
|
15
|
+
conn = nil
|
16
|
+
EM.run do
|
17
|
+
conn = EM.connect '192.0.2.0', 80, StubConnection
|
18
|
+
conn.pending_connect_timeout = 1
|
19
|
+
end
|
20
|
+
assert_equal Errno::ETIMEDOUT, conn.error
|
26
21
|
end
|
27
22
|
|
28
23
|
def test_connect_refused
|
29
24
|
pend('FIXME: this test is broken on Windows') if windows?
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
error = reason
|
36
|
-
EM.stop
|
37
|
-
end
|
38
|
-
}
|
39
|
-
}
|
40
|
-
assert_equal Errno::ECONNREFUSED, error
|
25
|
+
conn = nil
|
26
|
+
EM.run do
|
27
|
+
conn = EM.connect '127.0.0.1', 12388, StubConnection
|
28
|
+
end
|
29
|
+
assert_equal Errno::ECONNREFUSED, conn.error
|
41
30
|
end
|
42
31
|
|
43
32
|
def test_optional_argument
|
44
33
|
pend('FIXME: this test is broken on Windows') if windows?
|
45
|
-
|
46
34
|
conn = nil
|
47
|
-
EM.run
|
35
|
+
EM.run do
|
48
36
|
conn = EM.connect '127.0.0.1', 12388, StubConnection
|
49
|
-
|
37
|
+
end
|
50
38
|
assert_equal Errno::ECONNREFUSED, conn.error
|
51
39
|
end
|
52
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francis Cianfrocca
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -209,7 +209,6 @@ files:
|
|
209
209
|
- tests/test_file_watch.rb
|
210
210
|
- tests/test_fork.rb
|
211
211
|
- tests/test_futures.rb
|
212
|
-
- tests/test_get_sock_opt.rb
|
213
212
|
- tests/test_handler_check.rb
|
214
213
|
- tests/test_hc.rb
|
215
214
|
- tests/test_httpclient.rb
|
@@ -239,10 +238,10 @@ files:
|
|
239
238
|
- tests/test_sasl.rb
|
240
239
|
- tests/test_send_file.rb
|
241
240
|
- tests/test_servers.rb
|
242
|
-
- tests/test_set_sock_opt.rb
|
243
241
|
- tests/test_shutdown_hooks.rb
|
244
242
|
- tests/test_smtpclient.rb
|
245
243
|
- tests/test_smtpserver.rb
|
244
|
+
- tests/test_sock_opt.rb
|
246
245
|
- tests/test_spawn.rb
|
247
246
|
- tests/test_ssl_args.rb
|
248
247
|
- tests/test_ssl_dhparam.rb
|
@@ -323,7 +322,6 @@ test_files:
|
|
323
322
|
- tests/test_file_watch.rb
|
324
323
|
- tests/test_fork.rb
|
325
324
|
- tests/test_futures.rb
|
326
|
-
- tests/test_get_sock_opt.rb
|
327
325
|
- tests/test_handler_check.rb
|
328
326
|
- tests/test_hc.rb
|
329
327
|
- tests/test_httpclient.rb
|
@@ -353,10 +351,10 @@ test_files:
|
|
353
351
|
- tests/test_sasl.rb
|
354
352
|
- tests/test_send_file.rb
|
355
353
|
- tests/test_servers.rb
|
356
|
-
- tests/test_set_sock_opt.rb
|
357
354
|
- tests/test_shutdown_hooks.rb
|
358
355
|
- tests/test_smtpclient.rb
|
359
356
|
- tests/test_smtpserver.rb
|
357
|
+
- tests/test_sock_opt.rb
|
360
358
|
- tests/test_spawn.rb
|
361
359
|
- tests/test_ssl_args.rb
|
362
360
|
- tests/test_ssl_dhparam.rb
|
data/tests/test_get_sock_opt.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'em_test_helper'
|
2
|
-
require 'socket'
|
3
|
-
|
4
|
-
class TestGetSockOpt < Test::Unit::TestCase
|
5
|
-
|
6
|
-
if EM.respond_to? :get_sock_opt
|
7
|
-
def setup
|
8
|
-
assert(!EM.reactor_running?)
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
assert(!EM.reactor_running?)
|
13
|
-
end
|
14
|
-
|
15
|
-
#-------------------------------------
|
16
|
-
|
17
|
-
def test_get_sock_opt
|
18
|
-
test = self
|
19
|
-
EM.run do
|
20
|
-
EM.connect 'google.com', 80, Module.new {
|
21
|
-
define_method :connection_completed do
|
22
|
-
val = get_sock_opt Socket::SOL_SOCKET, Socket::SO_ERROR
|
23
|
-
test.assert_equal "\0\0\0\0", val
|
24
|
-
EM.stop
|
25
|
-
end
|
26
|
-
}
|
27
|
-
end
|
28
|
-
end
|
29
|
-
else
|
30
|
-
warn "EM.get_sock_opt not implemented, skipping tests in #{__FILE__}"
|
31
|
-
|
32
|
-
# Because some rubies will complain if a TestCase class has no tests
|
33
|
-
def test_em_get_sock_opt_unsupported
|
34
|
-
assert true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/tests/test_set_sock_opt.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'em_test_helper'
|
2
|
-
require 'socket'
|
3
|
-
|
4
|
-
class TestSetSockOpt < Test::Unit::TestCase
|
5
|
-
|
6
|
-
if EM.respond_to? :set_sock_opt
|
7
|
-
def setup
|
8
|
-
assert(!EM.reactor_running?)
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
assert(!EM.reactor_running?)
|
13
|
-
end
|
14
|
-
|
15
|
-
#-------------------------------------
|
16
|
-
|
17
|
-
def test_set_sock_opt
|
18
|
-
omit_if(windows?)
|
19
|
-
|
20
|
-
test = self
|
21
|
-
EM.run do
|
22
|
-
EM.connect 'google.com', 80, Module.new {
|
23
|
-
define_method :post_init do
|
24
|
-
val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true
|
25
|
-
test.assert_equal 0, val
|
26
|
-
EM.stop
|
27
|
-
end
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
else
|
32
|
-
warn "EM.set_sock_opt not implemented, skipping tests in #{__FILE__}"
|
33
|
-
|
34
|
-
# Because some rubies will complain if a TestCase class has no tests
|
35
|
-
def test_em_set_sock_opt_unsupported
|
36
|
-
assert true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|