eventmachine 1.0.9.1-java → 1.2.0.1-java

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +2 -2
  4. data/ext/cmain.cpp +77 -5
  5. data/ext/ed.cpp +112 -42
  6. data/ext/ed.h +27 -13
  7. data/ext/em.cpp +105 -163
  8. data/ext/em.h +10 -7
  9. data/ext/eventmachine.h +13 -1
  10. data/ext/extconf.rb +23 -14
  11. data/ext/fastfilereader/extconf.rb +1 -2
  12. data/ext/fastfilereader/rubymain.cpp +6 -6
  13. data/ext/project.h +9 -4
  14. data/ext/rubymain.cpp +155 -36
  15. data/ext/ssl.cpp +157 -13
  16. data/ext/ssl.h +7 -2
  17. data/lib/em/channel.rb +5 -0
  18. data/lib/em/completion.rb +2 -2
  19. data/lib/em/connection.rb +61 -3
  20. data/lib/em/iterator.rb +26 -5
  21. data/lib/em/pool.rb +1 -1
  22. data/lib/em/protocols/line_and_text.rb +1 -1
  23. data/lib/em/pure_ruby.rb +6 -1
  24. data/lib/em/queue.rb +16 -7
  25. data/lib/em/resolver.rb +46 -23
  26. data/lib/em/threaded_resource.rb +2 -2
  27. data/lib/em/version.rb +1 -1
  28. data/lib/eventmachine.rb +59 -42
  29. data/lib/rubyeventmachine.jar +0 -0
  30. data/rakelib/package.rake +23 -1
  31. data/tests/dhparam.pem +13 -0
  32. data/tests/em_test_helper.rb +79 -0
  33. data/tests/test_basic.rb +17 -26
  34. data/tests/test_channel.rb +14 -1
  35. data/tests/test_connection_write.rb +2 -2
  36. data/tests/test_defer.rb +17 -0
  37. data/tests/test_epoll.rb +1 -1
  38. data/tests/test_fork.rb +75 -0
  39. data/tests/test_ipv4.rb +125 -0
  40. data/tests/test_ipv6.rb +131 -0
  41. data/tests/test_iterator.rb +18 -0
  42. data/tests/test_many_fds.rb +1 -1
  43. data/tests/test_queue.rb +14 -0
  44. data/tests/test_resolver.rb +23 -0
  45. data/tests/test_set_sock_opt.rb +2 -0
  46. data/tests/test_ssl_dhparam.rb +83 -0
  47. data/tests/test_ssl_ecdh_curve.rb +79 -0
  48. data/tests/test_ssl_extensions.rb +49 -0
  49. data/tests/test_ssl_methods.rb +19 -0
  50. data/tests/test_ssl_protocols.rb +246 -0
  51. data/tests/test_ssl_verify.rb +44 -0
  52. data/tests/test_system.rb +4 -0
  53. data/tests/test_unbind_reason.rb +5 -1
  54. metadata +101 -20
  55. data/.gitignore +0 -21
  56. data/.travis.yml +0 -22
  57. data/.yardopts +0 -7
  58. data/Gemfile +0 -2
  59. data/Rakefile +0 -20
  60. data/eventmachine.gemspec +0 -38
  61. 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?)
data/tests/test_system.rb CHANGED
@@ -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.1
5
5
  platform: java
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-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.3
33
+ version: 0.9.5
34
34
  name: rake-compiler
35
35
  prerelease: false
36
36
  type: :development
@@ -38,22 +38,22 @@ dependencies:
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
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.5.2
48
- name: yard
47
+ version: 0.5.1
48
+ name: rake-compiler-dock
49
49
  prerelease: false
50
50
  type: :development
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 0.8.5.2
56
- description: |-
55
+ version: 0.5.1
56
+ description: |
57
57
  EventMachine implements a fast, single-threaded engine for arbitrary network
58
58
  communications. It's extremely easy to use in Ruby. EventMachine wraps all
59
59
  interactions with IP sockets, allowing programs to concentrate on the
@@ -86,15 +86,10 @@ extra_rdoc_files:
86
86
  - docs/old/SPAWNED_PROCESSES
87
87
  - docs/old/TODO
88
88
  files:
89
- - ".gitignore"
90
- - ".travis.yml"
91
- - ".yardopts"
92
89
  - CHANGELOG.md
93
90
  - GNU
94
- - Gemfile
95
91
  - LICENSE
96
92
  - README.md
97
- - Rakefile
98
93
  - docs/DocumentationGuidesIndex.md
99
94
  - docs/GettingStarted.md
100
95
  - docs/old/ChangeLog
@@ -109,7 +104,6 @@ files:
109
104
  - docs/old/SMTP
110
105
  - docs/old/SPAWNED_PROCESSES
111
106
  - docs/old/TODO
112
- - eventmachine.gemspec
113
107
  - examples/guides/getting_started/01_eventmachine_echo_server.rb
114
108
  - examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
115
109
  - examples/guides/getting_started/03_simple_chat_server.rb
@@ -193,11 +187,11 @@ files:
193
187
  - lib/eventmachine.rb
194
188
  - lib/jeventmachine.rb
195
189
  - lib/rubyeventmachine.jar
196
- - rakelib/cpp.rake_example
197
190
  - rakelib/package.rake
198
191
  - rakelib/test.rake
199
192
  - tests/client.crt
200
193
  - tests/client.key
194
+ - tests/dhparam.pem
201
195
  - tests/em_test_helper.rb
202
196
  - tests/test_attach.rb
203
197
  - tests/test_basic.rb
@@ -211,6 +205,7 @@ files:
211
205
  - tests/test_error_handler.rb
212
206
  - tests/test_exc.rb
213
207
  - tests/test_file_watch.rb
208
+ - tests/test_fork.rb
214
209
  - tests/test_futures.rb
215
210
  - tests/test_get_sock_opt.rb
216
211
  - tests/test_handler_check.rb
@@ -219,6 +214,8 @@ files:
219
214
  - tests/test_httpclient2.rb
220
215
  - tests/test_idle_connection.rb
221
216
  - tests/test_inactivity_timeout.rb
217
+ - tests/test_ipv4.rb
218
+ - tests/test_ipv6.rb
222
219
  - tests/test_iterator.rb
223
220
  - tests/test_kb.rb
224
221
  - tests/test_line_protocol.rb
@@ -246,7 +243,11 @@ files:
246
243
  - tests/test_smtpserver.rb
247
244
  - tests/test_spawn.rb
248
245
  - tests/test_ssl_args.rb
246
+ - tests/test_ssl_dhparam.rb
247
+ - tests/test_ssl_ecdh_curve.rb
248
+ - tests/test_ssl_extensions.rb
249
249
  - tests/test_ssl_methods.rb
250
+ - tests/test_ssl_protocols.rb
250
251
  - tests/test_ssl_verify.rb
251
252
  - tests/test_stomp.rb
252
253
  - tests/test_system.rb
@@ -258,7 +259,7 @@ files:
258
259
  homepage: http://rubyeventmachine.com
259
260
  licenses:
260
261
  - Ruby
261
- - GPL
262
+ - GPL-2.0
262
263
  metadata: {}
263
264
  post_install_message:
264
265
  rdoc_options:
@@ -283,9 +284,89 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
284
  - !ruby/object:Gem::Version
284
285
  version: '0'
285
286
  requirements: []
286
- rubyforge_project: eventmachine
287
+ rubyforge_project:
287
288
  rubygems_version: 2.4.8
288
289
  signing_key:
289
290
  specification_version: 4
290
291
  summary: Ruby/EventMachine library
291
- test_files: []
292
+ test_files:
293
+ - examples/guides/getting_started/01_eventmachine_echo_server.rb
294
+ - examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
295
+ - examples/guides/getting_started/03_simple_chat_server.rb
296
+ - examples/guides/getting_started/04_simple_chat_server_step_one.rb
297
+ - examples/guides/getting_started/05_simple_chat_server_step_two.rb
298
+ - examples/guides/getting_started/06_simple_chat_server_step_three.rb
299
+ - examples/guides/getting_started/07_simple_chat_server_step_four.rb
300
+ - examples/guides/getting_started/08_simple_chat_server_step_five.rb
301
+ - examples/old/ex_channel.rb
302
+ - examples/old/ex_queue.rb
303
+ - examples/old/ex_tick_loop_array.rb
304
+ - examples/old/ex_tick_loop_counter.rb
305
+ - examples/old/helper.rb
306
+ - tests/client.crt
307
+ - tests/client.key
308
+ - tests/dhparam.pem
309
+ - tests/em_test_helper.rb
310
+ - tests/test_attach.rb
311
+ - tests/test_basic.rb
312
+ - tests/test_channel.rb
313
+ - tests/test_completion.rb
314
+ - tests/test_connection_count.rb
315
+ - tests/test_connection_write.rb
316
+ - tests/test_defer.rb
317
+ - tests/test_deferrable.rb
318
+ - tests/test_epoll.rb
319
+ - tests/test_error_handler.rb
320
+ - tests/test_exc.rb
321
+ - tests/test_file_watch.rb
322
+ - tests/test_fork.rb
323
+ - tests/test_futures.rb
324
+ - tests/test_get_sock_opt.rb
325
+ - tests/test_handler_check.rb
326
+ - tests/test_hc.rb
327
+ - tests/test_httpclient.rb
328
+ - tests/test_httpclient2.rb
329
+ - tests/test_idle_connection.rb
330
+ - tests/test_inactivity_timeout.rb
331
+ - tests/test_ipv4.rb
332
+ - tests/test_ipv6.rb
333
+ - tests/test_iterator.rb
334
+ - tests/test_kb.rb
335
+ - tests/test_line_protocol.rb
336
+ - tests/test_ltp.rb
337
+ - tests/test_ltp2.rb
338
+ - tests/test_many_fds.rb
339
+ - tests/test_next_tick.rb
340
+ - tests/test_object_protocol.rb
341
+ - tests/test_pause.rb
342
+ - tests/test_pending_connect_timeout.rb
343
+ - tests/test_pool.rb
344
+ - tests/test_process_watch.rb
345
+ - tests/test_processes.rb
346
+ - tests/test_proxy_connection.rb
347
+ - tests/test_pure.rb
348
+ - tests/test_queue.rb
349
+ - tests/test_resolver.rb
350
+ - tests/test_running.rb
351
+ - tests/test_sasl.rb
352
+ - tests/test_send_file.rb
353
+ - tests/test_servers.rb
354
+ - tests/test_set_sock_opt.rb
355
+ - tests/test_shutdown_hooks.rb
356
+ - tests/test_smtpclient.rb
357
+ - tests/test_smtpserver.rb
358
+ - tests/test_spawn.rb
359
+ - tests/test_ssl_args.rb
360
+ - tests/test_ssl_dhparam.rb
361
+ - tests/test_ssl_ecdh_curve.rb
362
+ - tests/test_ssl_extensions.rb
363
+ - tests/test_ssl_methods.rb
364
+ - tests/test_ssl_protocols.rb
365
+ - tests/test_ssl_verify.rb
366
+ - tests/test_stomp.rb
367
+ - tests/test_system.rb
368
+ - tests/test_threaded_resource.rb
369
+ - tests/test_tick_loop.rb
370
+ - tests/test_timers.rb
371
+ - tests/test_ud.rb
372
+ - 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
-
data/.travis.yml DELETED
@@ -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
data/eventmachine.gemspec DELETED
@@ -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
@@ -1,77 +0,0 @@
1
- # EventMachine C++ Rakefile Stab Case
2
- # TODO : track header files as a build dependency...
3
- # TODO : cross platform support
4
- # TODO : configure style functionality
5
- namespace :cpp do
6
-
7
- require 'rake/clean'
8
-
9
- # *nix only atm...
10
- module Cpp
11
- class <<self
12
- def cpp; "g++"; end
13
- def archive; "ar"; end
14
- def compile file, output, includes=nil, flags=nil
15
- sh %{#{cpp} #{file} #{includes} #{flags} -c -o #{output}}
16
- end
17
- def link file, output, libs=nil, flags=nil
18
- sh %{#{cpp} #{file} #{libs} #{flags} -o #{output}}
19
- end
20
- def static output, files
21
- sh %{#{archive} cr #{output} #{files}}
22
- end
23
- end
24
- end
25
-
26
- module EmConfig
27
- Path = ENV['EVENTMACHINE_SOURCE'] || 'ext'
28
- Sources = FileList["#{Path}/*.cpp"]
29
- Sources.delete_if { |s| /ruby/ =~ s }
30
- Compiled = Sources.sub(%r{^#{Path}/(.*)\.cpp}, "#{Path}/\\1.o")
31
-
32
- Flags = "-O2 -pipe -fno-common -DOS_UNIX -DWITHOUT_SSL"
33
- Includes = ""
34
- Libs = ''
35
- end
36
- CLEAN.include(EmConfig::Compiled)
37
-
38
- rule %r{^#{EmConfig::Path}/.*\.o$} => [proc { |targ|
39
- targ.sub(%r{^#{EmConfig::Path}/(.*)\.o$}, "#{EmConfig::Path}/\\1.cpp")
40
- }] do |t|
41
- Cpp.compile t.source, t.name, EmConfig::Includes, EmConfig::Flags
42
- end
43
-
44
- file "#{EmConfig::Path}/libeventmachine.a" => EmConfig::Compiled do |t|
45
- Cpp.static t.name, EmConfig::Compiled
46
- end
47
- CLEAN.include("#{EmConfig::Path}/libeventmachine.a")
48
-
49
- module AppConfig
50
- Appname = 'echo_em'
51
- Sources = FileList['*.cpp']
52
- Compiled = Sources.sub(%r{^(.*)\.cpp}, '\\1.o')
53
-
54
- Flags = ["", EmConfig::Flags].join(' ')
55
- Includes = ["-I. -I#{EmConfig::Path}", EmConfig::Includes].join(' ')
56
- Libs = ["-L#{EmConfig::Path} -leventmachine", EmConfig::Libs].join(' ')
57
- end
58
- CLEAN.include(AppConfig::Compiled)
59
- CLEAN.include(AppConfig::Appname)
60
-
61
- rule %r{^.*\.o$} => [proc { |targ|
62
- targ.sub(%r{^(.*)\.o$}, '\\1.cpp')
63
- }] do |t|
64
- Cpp.compile t.source, t.name, AppConfig::Includes, AppConfig::Flags
65
- end
66
-
67
- file AppConfig::Appname => ["#{EmConfig::Path}/libeventmachine.a", AppConfig::Compiled] do |t|
68
- Cpp.link AppConfig::Compiled, t.name, AppConfig::Libs, AppConfig::Flags
69
- end
70
-
71
- task :build => AppConfig::Appname
72
-
73
- task :run => AppConfig::Appname do
74
- sh "./#{AppConfig::Appname}"
75
- end
76
-
77
- end