eventmachine 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ script: rake compile test
2
+ language: ruby
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.3
6
+ - rbx-18mode
7
+ - rbx-19mode
8
+ - jruby
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: rbx-18mode
12
+ - rvm: rbx-19mode
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 1.0.1 (February 27, 2013)
4
+ * use rb_wait_for_single_fd() on ruby 2.0 to fix rb_thread_select() deprecation
5
+ * fix epoll/kqueue mode in ruby 2.0 by removing calls to rb_enable_interrupt() [#248, #389]
6
+ * fix memory leak when verifying ssl cerificates [#403]
7
+ * fix initial connection delay [#393, #374]
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
-
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
15
15
 
16
- s.add_development_dependency 'rake-compiler', '~> 0.8.1'
17
- s.add_development_dependency 'yard', ">= 0.7.2"
18
- s.add_development_dependency 'bluecloth'
16
+ s.add_development_dependency 'rake-compiler', '~> 0.8.3'
17
+ s.add_development_dependency 'yard', ">= 0.8.5.2"
18
+ s.add_development_dependency 'bluecloth' unless RUBY_PLATFORM =~ /java/
19
19
 
20
20
  s.summary = 'Ruby/EventMachine library'
21
21
  s.description = "EventMachine implements a fast, single-threaded engine for arbitrary network
data/ext/ed.cpp CHANGED
@@ -460,6 +460,8 @@ ConnectionDescriptor::SetConnectPending
460
460
  void ConnectionDescriptor::SetConnectPending(bool f)
461
461
  {
462
462
  bConnectPending = f;
463
+ if (f == false && NextHeartbeat)
464
+ MyEventMachine->ClearHeartbeat(NextHeartbeat, this);
463
465
  _UpdateEvents();
464
466
  }
465
467
 
data/ext/em.cpp CHANGED
@@ -524,12 +524,17 @@ bool EventMachine_t::_RunEpollOnce()
524
524
 
525
525
  #ifdef BUILD_FOR_RUBY
526
526
  int ret = 0;
527
+
528
+ #ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
529
+ if ((ret = rb_wait_for_single_fd(epfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
530
+ #else
527
531
  fd_set fdreads;
528
532
 
529
533
  FD_ZERO(&fdreads);
530
534
  FD_SET(epfd, &fdreads);
531
535
 
532
536
  if ((ret = rb_thread_select(epfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
537
+ #endif
533
538
  if (ret == -1) {
534
539
  assert(errno != EINVAL);
535
540
  assert(errno != EBADF);
@@ -598,12 +603,17 @@ bool EventMachine_t::_RunKqueueOnce()
598
603
 
599
604
  #ifdef BUILD_FOR_RUBY
600
605
  int ret = 0;
606
+
607
+ #ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
608
+ if ((ret = rb_wait_for_single_fd(kqfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
609
+ #else
601
610
  fd_set fdreads;
602
611
 
603
612
  FD_ZERO(&fdreads);
604
613
  FD_SET(kqfd, &fdreads);
605
614
 
606
615
  if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
616
+ #endif
607
617
  if (ret == -1) {
608
618
  assert(errno != EINVAL);
609
619
  assert(errno != EBADF);
data/ext/em.h CHANGED
@@ -24,9 +24,13 @@ See the file COPYING for complete licensing information.
24
24
  #include <ruby.h>
25
25
  #define EmSelect rb_thread_select
26
26
 
27
+ #ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
28
+ #include <ruby/io.h>
29
+ #endif
30
+
27
31
  #if defined(HAVE_RBTRAP)
28
32
  #include <rubysig.h>
29
- #elif defined(HAVE_RB_THREAD_CHECK_INTS)
33
+ #elif defined(HAVE_RB_ENABLE_INTERRUPT)
30
34
  extern "C" {
31
35
  void rb_enable_interrupt(void);
32
36
  void rb_disable_interrupt(void);
@@ -71,13 +71,14 @@ add_define "HAVE_INOTIFY" if inotify = have_func('inotify_init', 'sys/inotify.h'
71
71
  add_define "HAVE_OLD_INOTIFY" if !inotify && have_macro('__NR_inotify_init', 'sys/syscall.h')
72
72
  add_define 'HAVE_WRITEV' if have_func('writev', 'sys/uio.h')
73
73
 
74
- have_func('rb_thread_check_ints')
74
+ have_func('rb_wait_for_single_fd')
75
+ have_func('rb_enable_interrupt')
75
76
  have_func('rb_time_new')
76
77
 
77
78
  # Minor platform details between *nix and Windows:
78
79
 
79
80
  if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
80
- GNU_CHAIN = ENV['CROSS_COMPILING'] or $1 == 'mingw'
81
+ GNU_CHAIN = ENV['CROSS_COMPILING'] || $1 == 'mingw'
81
82
  OS_WIN32 = true
82
83
  add_define "OS_WIN32"
83
84
  else
@@ -17,7 +17,7 @@ add_define 'BUILD_FOR_RUBY'
17
17
  # Minor platform details between *nix and Windows:
18
18
 
19
19
  if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
20
- GNU_CHAIN = ENV['CROSS_COMPILING'] or $1 == 'mingw'
20
+ GNU_CHAIN = ENV['CROSS_COMPILING'] || $1 == 'mingw'
21
21
  OS_WIN32 = true
22
22
  add_define "OS_WIN32"
23
23
  else
@@ -332,7 +332,7 @@ static VALUE t_get_peer_cert (VALUE self, VALUE signature)
332
332
  BIO_get_mem_ptr(out, &buf);
333
333
  ret = rb_str_new(buf->data, buf->length);
334
334
  X509_free(cert);
335
- BUF_MEM_free(buf);
335
+ BIO_free(out);
336
336
  }
337
337
  #endif
338
338
 
@@ -459,7 +459,7 @@ extern "C" int ssl_verify_wrapper(int preverify_ok, X509_STORE_CTX *ctx)
459
459
 
460
460
  ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject(binding));
461
461
  result = (cd->VerifySslPeer(buf->data) == true ? 1 : 0);
462
- BUF_MEM_free(buf);
462
+ BIO_free(out);
463
463
 
464
464
  return result;
465
465
  }
@@ -271,7 +271,7 @@ module EventMachine
271
271
  psw = psw.call
272
272
  end
273
273
  #str = Base64::encode64("\0#{@args[:auth][:username]}\0#{psw}").chomp
274
- str = ["\0#{@args[:auth][:username]}\0#{psw}"].pack("m").chomp
274
+ str = ["\0#{@args[:auth][:username]}\0#{psw}"].pack("m").gsub(/\n/, '')
275
275
  send_data "AUTH PLAIN #{str}\r\n"
276
276
  @responder = :receive_auth_response
277
277
  else
@@ -1,3 +1,3 @@
1
1
  module EventMachine
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,8 +1,8 @@
1
- if RUBY_PLATFORM =~ /java/
1
+ if defined?(EventMachine.library_type) and EventMachine.library_type == :pure_ruby
2
+ # assume 'em/pure_ruby' was loaded already
3
+ elsif RUBY_PLATFORM =~ /java/
2
4
  require 'java'
3
5
  require 'jeventmachine'
4
- elsif defined?(EventMachine.library_type) and EventMachine.library_type == :pure_ruby
5
- # assume 'em/pure_ruby' was loaded already
6
6
  else
7
7
  begin
8
8
  require 'rubyeventmachine'
@@ -1,4 +1,6 @@
1
- require 'rake/gempackagetask'
1
+ require 'rubygems'
2
+ require 'rubygems/package_task'
3
+
2
4
  begin
3
5
  require 'rake/extensiontask'
4
6
  require 'rake/javaextensiontask'
@@ -12,7 +14,7 @@ rake-compiler gem seems to be missing. Please install it with
12
14
  MSG
13
15
  end
14
16
 
15
- Rake::GemPackageTask.new(GEMSPEC) do |pkg|
17
+ Gem::PackageTask.new(GEMSPEC) do |pkg|
16
18
  end
17
19
 
18
20
  if RUBY_PLATFORM =~ /java/
@@ -84,15 +86,3 @@ def gem_cmd(action, name, *args)
84
86
  end
85
87
 
86
88
  Rake::Task[:clean].enhance [:clobber_package]
87
-
88
- namespace :gem do
89
- desc 'Install gem (and sudo if required)'
90
- task :install => :package do
91
- gem_cmd(:install, "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem")
92
- end
93
-
94
- desc 'Uninstall gem (and sudo if required)'
95
- task :uninstall do
96
- gem_cmd(:uninstall, "#{GEMSPEC.name}", "-v=#{GEMSPEC.version}")
97
- end
98
- end
@@ -19,7 +19,7 @@ class TestSetSockOpt < Test::Unit::TestCase
19
19
  EM.run do
20
20
  EM.connect 'google.com', 80, Module.new {
21
21
  define_method :post_init do
22
- val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_DEBUG, true
22
+ val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true
23
23
  test.assert_equal 0, val
24
24
  EM.stop
25
25
  end
metadata CHANGED
@@ -1,69 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: eventmachine
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Francis Cianfrocca
14
9
  - Aman Gupta
15
- autorequire:
10
+ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2012-09-08 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2013-02-28 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: rake-compiler
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ version_requirements: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.3
22
+ none: false
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.8.3
25
28
  none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 61
30
- segments:
31
- - 0
32
- - 8
33
- - 1
34
- version: 0.8.1
29
+ prerelease: false
35
30
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
31
+ - !ruby/object:Gem::Dependency
38
32
  name: yard
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
33
+ version_requirements: !ruby/object:Gem::Requirement
34
+ requirements:
43
35
  - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 0
48
- - 7
49
- - 2
50
- version: 0.7.2
51
- type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: bluecloth
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ - !ruby/object:Gem::Version
37
+ version: 0.8.5.2
57
38
  none: false
58
- requirements:
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
59
41
  - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
42
+ - !ruby/object:Gem::Version
43
+ version: 0.8.5.2
44
+ none: false
45
+ prerelease: false
65
46
  type: :development
66
- version_requirements: *id003
67
47
  description: |-
68
48
  EventMachine implements a fast, single-threaded engine for arbitrary network
69
49
  communications. It's extremely easy to use in Ruby. EventMachine wraps all
@@ -75,15 +55,14 @@ description: |-
75
55
  are provided with the package, primarily to serve as examples. The real goal
76
56
  of EventMachine is to enable programs to easily interface with other programs
77
57
  using TCP/IP, especially if custom protocols are required.
78
- email:
58
+ email:
79
59
  - garbagecat10@gmail.com
80
60
  - aman@tmm1.net
81
61
  executables: []
82
-
83
- extensions:
62
+ extensions:
84
63
  - ext/extconf.rb
85
64
  - ext/fastfilereader/extconf.rb
86
- extra_rdoc_files:
65
+ extra_rdoc_files:
87
66
  - README.md
88
67
  - docs/DocumentationGuidesIndex.md
89
68
  - docs/GettingStarted.md
@@ -99,9 +78,11 @@ extra_rdoc_files:
99
78
  - docs/old/SMTP
100
79
  - docs/old/SPAWNED_PROCESSES
101
80
  - docs/old/TODO
102
- files:
103
- - .gitignore
104
- - .yardopts
81
+ files:
82
+ - ".gitignore"
83
+ - ".travis.yml"
84
+ - ".yardopts"
85
+ - CHANGELOG.md
105
86
  - GNU
106
87
  - Gemfile
107
88
  - LICENSE
@@ -262,43 +243,42 @@ files:
262
243
  - tests/test_unbind_reason.rb
263
244
  homepage: http://rubyeventmachine.com
264
245
  licenses: []
265
-
266
- post_install_message:
267
- rdoc_options:
268
- - --title
246
+ post_install_message:
247
+ rdoc_options:
248
+ - "--title"
269
249
  - EventMachine
270
- - --main
250
+ - "--main"
271
251
  - README.md
272
- - -x
252
+ - "-x"
273
253
  - lib/em/version
274
- - -x
254
+ - "-x"
275
255
  - lib/jeventmachine
276
- require_paths:
256
+ require_paths:
277
257
  - lib
278
- required_ruby_version: !ruby/object:Gem::Requirement
279
- none: false
280
- requirements:
258
+ required_ruby_version: !ruby/object:Gem::Requirement
259
+ requirements:
281
260
  - - ">="
282
- - !ruby/object:Gem::Version
283
- hash: 3
284
- segments:
261
+ - !ruby/object:Gem::Version
262
+ segments:
285
263
  - 0
286
- version: "0"
287
- required_rubygems_version: !ruby/object:Gem::Requirement
264
+ hash: 2
265
+ version: !binary |-
266
+ MA==
288
267
  none: false
289
- requirements:
268
+ required_rubygems_version: !ruby/object:Gem::Requirement
269
+ requirements:
290
270
  - - ">="
291
- - !ruby/object:Gem::Version
292
- hash: 3
293
- segments:
271
+ - !ruby/object:Gem::Version
272
+ segments:
294
273
  - 0
295
- version: "0"
274
+ hash: 2
275
+ version: !binary |-
276
+ MA==
277
+ none: false
296
278
  requirements: []
297
-
298
279
  rubyforge_project: eventmachine
299
280
  rubygems_version: 1.8.24
300
- signing_key:
281
+ signing_key:
301
282
  specification_version: 3
302
283
  summary: Ruby/EventMachine library
303
284
  test_files: []
304
-