eventmachine 1.0.9.1 → 1.2.0.dev.2

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/cmain.cpp +77 -5
  4. data/ext/ed.cpp +100 -39
  5. data/ext/ed.h +27 -13
  6. data/ext/em.cpp +105 -163
  7. data/ext/em.h +10 -7
  8. data/ext/eventmachine.h +13 -1
  9. data/ext/extconf.rb +22 -13
  10. data/ext/fastfilereader/rubymain.cpp +6 -6
  11. data/ext/project.h +9 -4
  12. data/ext/rubymain.cpp +155 -36
  13. data/ext/ssl.cpp +157 -13
  14. data/ext/ssl.h +7 -2
  15. data/lib/em/channel.rb +5 -0
  16. data/lib/em/completion.rb +2 -2
  17. data/lib/em/connection.rb +61 -3
  18. data/lib/em/iterator.rb +26 -5
  19. data/lib/em/pool.rb +1 -1
  20. data/lib/em/protocols/line_and_text.rb +1 -1
  21. data/lib/em/pure_ruby.rb +6 -1
  22. data/lib/em/queue.rb +16 -7
  23. data/lib/em/resolver.rb +46 -23
  24. data/lib/em/threaded_resource.rb +2 -2
  25. data/lib/em/version.rb +1 -1
  26. data/lib/eventmachine.rb +59 -42
  27. data/rakelib/package.rake +23 -1
  28. data/tests/dhparam.pem +13 -0
  29. data/tests/em_test_helper.rb +79 -0
  30. data/tests/test_basic.rb +17 -26
  31. data/tests/test_channel.rb +14 -1
  32. data/tests/test_connection_write.rb +2 -2
  33. data/tests/test_defer.rb +17 -0
  34. data/tests/test_epoll.rb +1 -1
  35. data/tests/test_fork.rb +75 -0
  36. data/tests/test_ipv4.rb +125 -0
  37. data/tests/test_ipv6.rb +131 -0
  38. data/tests/test_iterator.rb +18 -0
  39. data/tests/test_many_fds.rb +1 -1
  40. data/tests/test_queue.rb +14 -0
  41. data/tests/test_resolver.rb +23 -0
  42. data/tests/test_set_sock_opt.rb +2 -0
  43. data/tests/test_ssl_dhparam.rb +83 -0
  44. data/tests/test_ssl_ecdh_curve.rb +79 -0
  45. data/tests/test_ssl_extensions.rb +49 -0
  46. data/tests/test_ssl_methods.rb +19 -0
  47. data/tests/test_ssl_protocols.rb +246 -0
  48. data/tests/test_ssl_verify.rb +44 -0
  49. data/tests/test_system.rb +4 -0
  50. data/tests/test_unbind_reason.rb +5 -1
  51. metadata +116 -49
  52. data/.gitignore +0 -21
  53. data/.travis.yml +0 -22
  54. data/.yardopts +0 -7
  55. data/Gemfile +0 -2
  56. data/Rakefile +0 -20
  57. data/eventmachine.gemspec +0 -38
  58. data/rakelib/cpp.rake_example +0 -77
@@ -6,6 +6,21 @@ class TestSslVerify < Test::Unit::TestCase
6
6
  $cert_from_file = File.read($dir+'client.crt')
7
7
  end
8
8
 
9
+ module ClientNoCert
10
+ def connection_completed
11
+ start_tls()
12
+ end
13
+
14
+ def ssl_handshake_completed
15
+ $client_handshake_completed = true
16
+ close_connection
17
+ end
18
+
19
+ def unbind
20
+ EM.stop_event_loop
21
+ end
22
+ end
23
+
9
24
  module Client
10
25
  def connection_completed
11
26
  start_tls(:private_key_file => $dir+'client.key', :cert_chain_file => $dir+'client.crt')
@@ -52,6 +67,35 @@ class TestSslVerify < Test::Unit::TestCase
52
67
  end
53
68
  end
54
69
 
70
+ module FailServerNoPeerCert
71
+ def post_init
72
+ start_tls(:verify_peer => true, :fail_if_no_peer_cert => true)
73
+ end
74
+
75
+ def ssl_verify_peer(cert)
76
+ raise "Verify peer should not get called for a client without a certificate"
77
+ end
78
+
79
+ def ssl_handshake_completed
80
+ $server_handshake_completed = true
81
+ end
82
+ end
83
+
84
+ def test_fail_no_peer_cert
85
+ omit_unless(EM.ssl?)
86
+ omit_if(rbx?)
87
+
88
+ $client_handshake_completed, $server_handshake_completed = false, false
89
+
90
+ EM.run {
91
+ EM.start_server("127.0.0.1", 16784, FailServerNoPeerCert)
92
+ EM.connect("127.0.0.1", 16784, ClientNoCert)
93
+ }
94
+
95
+ assert(!$client_handshake_completed)
96
+ assert(!$server_handshake_completed)
97
+ end
98
+
55
99
  def test_accept_server
56
100
  omit_unless(EM.ssl?)
57
101
  omit_if(rbx?)
@@ -9,6 +9,8 @@ class TestSystem < Test::Unit::TestCase
9
9
  end
10
10
 
11
11
  def test_system
12
+ omit_if(windows?)
13
+
12
14
  result = nil
13
15
  status = nil
14
16
  EM.run {
@@ -23,6 +25,8 @@ class TestSystem < Test::Unit::TestCase
23
25
  end
24
26
 
25
27
  def test_system_with_string
28
+ omit_if(windows?)
29
+
26
30
  result = nil
27
31
  status = nil
28
32
  EM.run {
@@ -20,12 +20,14 @@ class TestUnbindReason < Test::Unit::TestCase
20
20
  EM.stop
21
21
  end
22
22
  }
23
- conn.pending_connect_timeout = 0.1
23
+ conn.pending_connect_timeout = TIMEOUT_INTERVAL
24
24
  }
25
25
  assert_equal Errno::ETIMEDOUT, error
26
26
  end
27
27
 
28
28
  def test_connect_refused
29
+ pend('FIXME: this test is broken on Windows') if windows?
30
+
29
31
  error = nil
30
32
  EM.run {
31
33
  EM.connect '127.0.0.1', 12388, Module.new{ |m|
@@ -39,6 +41,8 @@ class TestUnbindReason < Test::Unit::TestCase
39
41
  end
40
42
 
41
43
  def test_optional_argument
44
+ pend('FIXME: this test is broken on Windows') if windows?
45
+
42
46
  conn = nil
43
47
  EM.run {
44
48
  conn = EM.connect '127.0.0.1', 12388, StubConnection
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.0.9.1
4
+ version: 1.2.0.dev.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: 2016-01-14 00:00:00.000000000 Z
12
+ date: 2016-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -31,43 +31,29 @@ dependencies:
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 0.8.3
34
+ version: 0.9.5
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: 0.8.3
41
+ version: 0.9.5
42
42
  - !ruby/object:Gem::Dependency
43
- name: yard
43
+ name: rake-compiler-dock
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
47
- - !ruby/object:Gem::Version
48
- version: 0.8.5.2
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - '>='
54
- - !ruby/object:Gem::Version
55
- version: 0.8.5.2
56
- - !ruby/object:Gem::Dependency
57
- name: bluecloth
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - '>='
46
+ - - ~>
61
47
  - !ruby/object:Gem::Version
62
- version: '0'
48
+ version: 0.5.1
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - '>='
53
+ - - ~>
68
54
  - !ruby/object:Gem::Version
69
- version: '0'
70
- description: |-
55
+ version: 0.5.1
56
+ description: |
71
57
  EventMachine implements a fast, single-threaded engine for arbitrary network
72
58
  communications. It's extremely easy to use in Ruby. EventMachine wraps all
73
59
  interactions with IP sockets, allowing programs to concentrate on the
@@ -102,15 +88,10 @@ extra_rdoc_files:
102
88
  - docs/old/SPAWNED_PROCESSES
103
89
  - docs/old/TODO
104
90
  files:
105
- - .gitignore
106
- - .travis.yml
107
- - .yardopts
108
91
  - CHANGELOG.md
109
92
  - GNU
110
- - Gemfile
111
93
  - LICENSE
112
94
  - README.md
113
- - Rakefile
114
95
  - docs/DocumentationGuidesIndex.md
115
96
  - docs/GettingStarted.md
116
97
  - docs/old/ChangeLog
@@ -125,20 +106,6 @@ files:
125
106
  - docs/old/SMTP
126
107
  - docs/old/SPAWNED_PROCESSES
127
108
  - docs/old/TODO
128
- - eventmachine.gemspec
129
- - examples/guides/getting_started/01_eventmachine_echo_server.rb
130
- - examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
131
- - examples/guides/getting_started/03_simple_chat_server.rb
132
- - examples/guides/getting_started/04_simple_chat_server_step_one.rb
133
- - examples/guides/getting_started/05_simple_chat_server_step_two.rb
134
- - examples/guides/getting_started/06_simple_chat_server_step_three.rb
135
- - examples/guides/getting_started/07_simple_chat_server_step_four.rb
136
- - examples/guides/getting_started/08_simple_chat_server_step_five.rb
137
- - examples/old/ex_channel.rb
138
- - examples/old/ex_queue.rb
139
- - examples/old/ex_tick_loop_array.rb
140
- - examples/old/ex_tick_loop_counter.rb
141
- - examples/old/helper.rb
142
109
  - ext/binder.cpp
143
110
  - ext/binder.h
144
111
  - ext/cmain.cpp
@@ -208,11 +175,24 @@ files:
208
175
  - lib/em/version.rb
209
176
  - lib/eventmachine.rb
210
177
  - lib/jeventmachine.rb
211
- - rakelib/cpp.rake_example
212
178
  - rakelib/package.rake
213
179
  - rakelib/test.rake
180
+ - examples/guides/getting_started/01_eventmachine_echo_server.rb
181
+ - examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
182
+ - examples/guides/getting_started/03_simple_chat_server.rb
183
+ - examples/guides/getting_started/04_simple_chat_server_step_one.rb
184
+ - examples/guides/getting_started/05_simple_chat_server_step_two.rb
185
+ - examples/guides/getting_started/06_simple_chat_server_step_three.rb
186
+ - examples/guides/getting_started/07_simple_chat_server_step_four.rb
187
+ - examples/guides/getting_started/08_simple_chat_server_step_five.rb
188
+ - examples/old/ex_channel.rb
189
+ - examples/old/ex_queue.rb
190
+ - examples/old/ex_tick_loop_array.rb
191
+ - examples/old/ex_tick_loop_counter.rb
192
+ - examples/old/helper.rb
214
193
  - tests/client.crt
215
194
  - tests/client.key
195
+ - tests/dhparam.pem
216
196
  - tests/em_test_helper.rb
217
197
  - tests/test_attach.rb
218
198
  - tests/test_basic.rb
@@ -226,6 +206,7 @@ files:
226
206
  - tests/test_error_handler.rb
227
207
  - tests/test_exc.rb
228
208
  - tests/test_file_watch.rb
209
+ - tests/test_fork.rb
229
210
  - tests/test_futures.rb
230
211
  - tests/test_get_sock_opt.rb
231
212
  - tests/test_handler_check.rb
@@ -234,6 +215,8 @@ files:
234
215
  - tests/test_httpclient2.rb
235
216
  - tests/test_idle_connection.rb
236
217
  - tests/test_inactivity_timeout.rb
218
+ - tests/test_ipv4.rb
219
+ - tests/test_ipv6.rb
237
220
  - tests/test_iterator.rb
238
221
  - tests/test_kb.rb
239
222
  - tests/test_line_protocol.rb
@@ -261,7 +244,11 @@ files:
261
244
  - tests/test_smtpserver.rb
262
245
  - tests/test_spawn.rb
263
246
  - tests/test_ssl_args.rb
247
+ - tests/test_ssl_dhparam.rb
248
+ - tests/test_ssl_ecdh_curve.rb
249
+ - tests/test_ssl_extensions.rb
264
250
  - tests/test_ssl_methods.rb
251
+ - tests/test_ssl_protocols.rb
265
252
  - tests/test_ssl_verify.rb
266
253
  - tests/test_stomp.rb
267
254
  - tests/test_system.rb
@@ -273,7 +260,7 @@ files:
273
260
  homepage: http://rubyeventmachine.com
274
261
  licenses:
275
262
  - Ruby
276
- - GPL
263
+ - GPL-2.0
277
264
  metadata: {}
278
265
  post_install_message:
279
266
  rdoc_options:
@@ -294,13 +281,93 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
281
  version: '0'
295
282
  required_rubygems_version: !ruby/object:Gem::Requirement
296
283
  requirements:
297
- - - '>='
284
+ - - '>'
298
285
  - !ruby/object:Gem::Version
299
- version: '0'
286
+ version: 1.3.1
300
287
  requirements: []
301
- rubyforge_project: eventmachine
288
+ rubyforge_project:
302
289
  rubygems_version: 2.0.14
303
290
  signing_key:
304
291
  specification_version: 4
305
292
  summary: Ruby/EventMachine library
306
- test_files: []
293
+ test_files:
294
+ - examples/guides/getting_started/01_eventmachine_echo_server.rb
295
+ - examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
296
+ - examples/guides/getting_started/03_simple_chat_server.rb
297
+ - examples/guides/getting_started/04_simple_chat_server_step_one.rb
298
+ - examples/guides/getting_started/05_simple_chat_server_step_two.rb
299
+ - examples/guides/getting_started/06_simple_chat_server_step_three.rb
300
+ - examples/guides/getting_started/07_simple_chat_server_step_four.rb
301
+ - examples/guides/getting_started/08_simple_chat_server_step_five.rb
302
+ - examples/old/ex_channel.rb
303
+ - examples/old/ex_queue.rb
304
+ - examples/old/ex_tick_loop_array.rb
305
+ - examples/old/ex_tick_loop_counter.rb
306
+ - examples/old/helper.rb
307
+ - tests/client.crt
308
+ - tests/client.key
309
+ - tests/dhparam.pem
310
+ - tests/em_test_helper.rb
311
+ - tests/test_attach.rb
312
+ - tests/test_basic.rb
313
+ - tests/test_channel.rb
314
+ - tests/test_completion.rb
315
+ - tests/test_connection_count.rb
316
+ - tests/test_connection_write.rb
317
+ - tests/test_defer.rb
318
+ - tests/test_deferrable.rb
319
+ - tests/test_epoll.rb
320
+ - tests/test_error_handler.rb
321
+ - tests/test_exc.rb
322
+ - tests/test_file_watch.rb
323
+ - tests/test_fork.rb
324
+ - tests/test_futures.rb
325
+ - tests/test_get_sock_opt.rb
326
+ - tests/test_handler_check.rb
327
+ - tests/test_hc.rb
328
+ - tests/test_httpclient.rb
329
+ - tests/test_httpclient2.rb
330
+ - tests/test_idle_connection.rb
331
+ - tests/test_inactivity_timeout.rb
332
+ - tests/test_ipv4.rb
333
+ - tests/test_ipv6.rb
334
+ - tests/test_iterator.rb
335
+ - tests/test_kb.rb
336
+ - tests/test_line_protocol.rb
337
+ - tests/test_ltp.rb
338
+ - tests/test_ltp2.rb
339
+ - tests/test_many_fds.rb
340
+ - tests/test_next_tick.rb
341
+ - tests/test_object_protocol.rb
342
+ - tests/test_pause.rb
343
+ - tests/test_pending_connect_timeout.rb
344
+ - tests/test_pool.rb
345
+ - tests/test_process_watch.rb
346
+ - tests/test_processes.rb
347
+ - tests/test_proxy_connection.rb
348
+ - tests/test_pure.rb
349
+ - tests/test_queue.rb
350
+ - tests/test_resolver.rb
351
+ - tests/test_running.rb
352
+ - tests/test_sasl.rb
353
+ - tests/test_send_file.rb
354
+ - tests/test_servers.rb
355
+ - tests/test_set_sock_opt.rb
356
+ - tests/test_shutdown_hooks.rb
357
+ - tests/test_smtpclient.rb
358
+ - tests/test_smtpserver.rb
359
+ - tests/test_spawn.rb
360
+ - tests/test_ssl_args.rb
361
+ - tests/test_ssl_dhparam.rb
362
+ - tests/test_ssl_ecdh_curve.rb
363
+ - tests/test_ssl_extensions.rb
364
+ - tests/test_ssl_methods.rb
365
+ - tests/test_ssl_protocols.rb
366
+ - tests/test_ssl_verify.rb
367
+ - tests/test_stomp.rb
368
+ - tests/test_system.rb
369
+ - tests/test_threaded_resource.rb
370
+ - tests/test_tick_loop.rb
371
+ - tests/test_timers.rb
372
+ - tests/test_ud.rb
373
+ - tests/test_unbind_reason.rb
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- pkg
2
- rdoc
3
- Makefile
4
-
5
- *.bundle
6
- *.dll
7
- *.so
8
- *.jar
9
- *.class
10
- *.o
11
- *.log
12
- *.def
13
- *.pdb
14
- *.dSYM
15
- java/src/.project
16
- *.rbc
17
- Gemfile.lock
18
-
19
- .yardoc/*
20
- doc/*
21
-
@@ -1,22 +0,0 @@
1
- script: bundle exec rake compile test
2
- env:
3
- global:
4
- - TESTOPTS=-v
5
- language: ruby
6
- sudo: false
7
- rvm:
8
- - 1.8.7
9
- - 1.9.2
10
- - 1.9.3
11
- - 2.0.0
12
- - 2.1
13
- - 2.2
14
- - rbx
15
- - jruby
16
- matrix:
17
- allow_failures:
18
- - rvm: rbx
19
- - rvm: jruby
20
- include:
21
- - rvm: 2.0.0
22
- os: osx
data/.yardopts DELETED
@@ -1,7 +0,0 @@
1
- --no-private
2
- --protected
3
- --markup="markdown" lib/**/*.rb
4
- --main README.md
5
- --exclude jeventmachine --exclude pure_ruby
6
- -
7
- docs/*.md
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/Rakefile DELETED
@@ -1,20 +0,0 @@
1
- require 'rubygems'
2
- GEMSPEC = Gem::Specification.load('eventmachine.gemspec')
3
-
4
- require 'rake/clean'
5
- task :clobber => :clean
6
-
7
- desc "Build eventmachine, then run tests."
8
- task :default => [:compile, :test]
9
-
10
- desc 'Generate documentation'
11
- begin
12
- require 'yard'
13
- YARD::Rake::YardocTask.new do |t|
14
- t.files = ['lib/**/*.rb', '-', 'docs/*.md']
15
- t.options = ['--main', 'README.md', '--no-private']
16
- t.options = ['--exclude', 'lib/jeventmachine', '--exclude', 'lib/pr_eventmachine']
17
- end
18
- rescue LoadError
19
- task :yard do puts "Please install yard first!"; end
20
- end
@@ -1,38 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.unshift File.expand_path("../lib", __FILE__)
3
- require "em/version"
4
-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'eventmachine'
8
- s.version = EventMachine::VERSION
9
- s.homepage = 'http://rubyeventmachine.com'
10
- s.rubyforge_project = 'eventmachine'
11
- s.licenses = ["Ruby", "GPL"]
12
-
13
- s.authors = ["Francis Cianfrocca", "Aman Gupta"]
14
- s.email = ["garbagecat10@gmail.com", "aman@tmm1.net"]
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
18
-
19
- s.add_development_dependency 'test-unit', '~> 2.0'
20
- s.add_development_dependency 'rake-compiler', '~> 0.8.3'
21
- s.add_development_dependency 'yard', ">= 0.8.5.2"
22
- s.add_development_dependency 'bluecloth' unless RUBY_PLATFORM =~ /java/
23
-
24
- s.summary = 'Ruby/EventMachine library'
25
- s.description = "EventMachine implements a fast, single-threaded engine for arbitrary network
26
- communications. It's extremely easy to use in Ruby. EventMachine wraps all
27
- interactions with IP sockets, allowing programs to concentrate on the
28
- implementation of network protocols. It can be used to create both network
29
- servers and clients. To create a server or client, a Ruby program only needs
30
- to specify the IP address and port, and provide a Module that implements the
31
- communications protocol. Implementations of several standard network protocols
32
- are provided with the package, primarily to serve as examples. The real goal
33
- of EventMachine is to enable programs to easily interface with other programs
34
- using TCP/IP, especially if custom protocols are required."
35
-
36
- s.rdoc_options = ["--title", "EventMachine", "--main", "README.md", "-x", "lib/em/version", "-x", "lib/jeventmachine"]
37
- s.extra_rdoc_files = ["README.md"] + `git ls-files -- docs/*`.split("\n")
38
- end