eventmachine-le 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -3
- data/eventmachine-le.gemspec +4 -3
- data/ext/ed.cpp +4 -2
- data/ext/em.cpp +43 -11
- data/ext/em.h +5 -1
- data/ext/extconf.rb +4 -3
- data/ext/fastfilereader/extconf.rb +1 -1
- data/ext/rubymain.cpp +1 -1
- data/ext/ssl.cpp +1 -1
- data/lib/em/processes.rb +1 -1
- data/lib/em/protocols/httpclient.rb +2 -2
- data/lib/em/protocols/smtpserver.rb +9 -5
- data/lib/em/protocols/stomp.rb +5 -2
- data/lib/em/version.rb +2 -1
- data/lib/eventmachine.rb +6 -1
- data/rakelib/package.rake +17 -19
- data/tests/test_epoll.rb +15 -0
- data/tests/test_idle_connection.rb +6 -4
- data/tests/test_ipv6.rb +2 -2
- data/tests/test_system.rb +42 -0
- metadata +32 -13
data/README.md
CHANGED
@@ -46,8 +46,18 @@ for EventMachine, just with additional (and fixed) functionality.
|
|
46
46
|
|
47
47
|
## Features and changes ##
|
48
48
|
|
49
|
-
The list of additions and improvements will grow over time. Currently
|
50
|
-
|
49
|
+
The list of additions and improvements will grow over time. Currently the following features/fixes have been applied in EventMachine-LE:
|
50
|
+
|
51
|
+
|
52
|
+
### Version 1.1.5
|
53
|
+
|
54
|
+
* Fix bug when the system time is changed to earlier time (which made EM to eat up the CPU cycle): [commit in EM](https://github.com/eventmachine/eventmachine/commit/1427a2c80c401d841194132a9af15baefd68b5ae).
|
55
|
+
* Fix crash on attach/detach in the same tick ([pietern](https://github.com/eventmachine/eventmachine/pull/427)).
|
56
|
+
* Fix `EM.system` when unicode characters used ([funny-falcon](https://github.com/eventmachine/eventmachine/pull/322)).
|
57
|
+
* Fix SMTP server behaviour to reset mail transaction state after sending message ([jonasschneider](https://github.com/eventmachine/eventmachine/pull/351)).
|
58
|
+
|
59
|
+
|
60
|
+
### Version 1.1.4 and below
|
51
61
|
|
52
62
|
* Full IPv6 support for TCP and UDP, in both server and client mode ([cabo]([https://github.com/eventmachine/eventmachine/pull/297)).
|
53
63
|
* Added robustness to datagram sockets, which now can optionally not to get destroyed on the first error by setting `EM::Connection#send_error_handling=mode` ([cabo]([https://github.com/eventmachine/eventmachine/pull/297)).
|
@@ -65,7 +75,7 @@ the following features/fixes have been applied in EventMachine-LE:
|
|
65
75
|
|
66
76
|
## Installation ##
|
67
77
|
|
68
|
-
|
78
|
+
Install the current stable version of EventMachine-LE:
|
69
79
|
<pre>
|
70
80
|
gem install eventmachine-le
|
71
81
|
</pre>
|
data/eventmachine-le.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.name = "eventmachine-le"
|
12
12
|
s.version = EventMachine::VERSION
|
13
13
|
s.homepage = "https://github.com/ibc/EventMachine-LE/"
|
14
|
+
s.licenses = ["Ruby", "GPL"]
|
14
15
|
|
15
16
|
s.authors = ["Francis Cianfrocca", "Aman Gupta", "hacked by Carsten Bormann and Inaki Baz Castillo"]
|
16
17
|
s.email = ["garbagecat10@gmail.com", "aman@tmm1.net", "cabo@tzi.org", "ibc@aliax.net"]
|
@@ -19,9 +20,9 @@ Gem::Specification.new do |s|
|
|
19
20
|
s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
|
20
21
|
|
21
22
|
s.required_ruby_version = ">= 1.8.7"
|
22
|
-
s.add_development_dependency
|
23
|
-
s.add_development_dependency
|
24
|
-
s.add_development_dependency
|
23
|
+
s.add_development_dependency 'rake-compiler', '~> 0.8.3'
|
24
|
+
s.add_development_dependency 'yard', ">= 0.8.5.2"
|
25
|
+
s.add_development_dependency 'bluecloth' unless RUBY_PLATFORM =~ /java/
|
25
26
|
|
26
27
|
s.summary = "EventMachine LE (Live Edition)"
|
27
28
|
s.description = "EventMachine-LE (Live Edition) is a branch of EventMachine (https://github.com/eventmachine/eventmachine).
|
data/ext/ed.cpp
CHANGED
@@ -464,6 +464,7 @@ ConnectionDescriptor::SetConnectPending
|
|
464
464
|
void ConnectionDescriptor::SetConnectPending(bool f)
|
465
465
|
{
|
466
466
|
bConnectPending = f;
|
467
|
+
MyEventMachine->QueueHeartbeat(this);
|
467
468
|
_UpdateEvents();
|
468
469
|
}
|
469
470
|
|
@@ -1452,14 +1453,15 @@ void AcceptorDescriptor::Read()
|
|
1452
1453
|
(*EventCallback) (GetBinding(), EM_CONNECTION_ACCEPTED, NULL, cd->GetBinding());
|
1453
1454
|
}
|
1454
1455
|
#ifdef HAVE_EPOLL
|
1455
|
-
cd->GetEpollEvent()->events = EPOLLIN | (cd->SelectForWrite() ? EPOLLOUT : 0);
|
1456
|
+
cd->GetEpollEvent()->events = (cd->SelectForRead() ? EPOLLIN : 0) | (cd->SelectForWrite() ? EPOLLOUT : 0);
|
1456
1457
|
#endif
|
1457
1458
|
assert (MyEventMachine);
|
1458
1459
|
MyEventMachine->Add (cd);
|
1459
1460
|
#ifdef HAVE_KQUEUE
|
1460
1461
|
if (cd->SelectForWrite())
|
1461
1462
|
MyEventMachine->ArmKqueueWriter (cd);
|
1462
|
-
|
1463
|
+
if (cd->SelectForRead())
|
1464
|
+
MyEventMachine->ArmKqueueReader (cd);
|
1463
1465
|
#endif
|
1464
1466
|
}
|
1465
1467
|
|
data/ext/em.cpp
CHANGED
@@ -343,16 +343,28 @@ EventMachine_t::_DispatchHeartbeats
|
|
343
343
|
|
344
344
|
void EventMachine_t::_DispatchHeartbeats()
|
345
345
|
{
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
346
|
+
// Store the first processed heartbeat descriptor and bail out if
|
347
|
+
// we see it again. This fixes an infinite loop in case the system time
|
348
|
+
// is changed out from underneath MyCurrentLoopTime.
|
349
|
+
const EventableDescriptor *head = NULL;
|
350
|
+
|
351
|
+
while (true) {
|
352
|
+
multimap<uint64_t,EventableDescriptor*>::iterator i = Heartbeats.begin();
|
353
|
+
if (i == Heartbeats.end())
|
354
|
+
break;
|
355
|
+
if (i->first > MyCurrentLoopTime)
|
356
|
+
break;
|
357
|
+
|
358
|
+
EventableDescriptor *ed = i->second;
|
359
|
+
if (ed == head)
|
360
|
+
break;
|
361
|
+
|
362
|
+
ed->Heartbeat();
|
363
|
+
QueueHeartbeat(ed);
|
364
|
+
|
365
|
+
if (head == NULL)
|
366
|
+
head = ed;
|
367
|
+
}
|
356
368
|
}
|
357
369
|
|
358
370
|
/******************************
|
@@ -485,12 +497,17 @@ bool EventMachine_t::_RunEpollOnce()
|
|
485
497
|
|
486
498
|
#ifdef BUILD_FOR_RUBY
|
487
499
|
int ret = 0;
|
500
|
+
|
501
|
+
#ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
|
502
|
+
if ((ret = rb_wait_for_single_fd(epfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
|
503
|
+
#else
|
488
504
|
fd_set fdreads;
|
489
505
|
|
490
506
|
FD_ZERO(&fdreads);
|
491
507
|
FD_SET(epfd, &fdreads);
|
492
508
|
|
493
509
|
if ((ret = rb_thread_select(epfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
|
510
|
+
#endif
|
494
511
|
if (ret == -1) {
|
495
512
|
assert(errno != EINVAL);
|
496
513
|
assert(errno != EBADF);
|
@@ -559,12 +576,17 @@ bool EventMachine_t::_RunKqueueOnce()
|
|
559
576
|
|
560
577
|
#ifdef BUILD_FOR_RUBY
|
561
578
|
int ret = 0;
|
579
|
+
|
580
|
+
#ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
|
581
|
+
if ((ret = rb_wait_for_single_fd(kqfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
|
582
|
+
#else
|
562
583
|
fd_set fdreads;
|
563
584
|
|
564
585
|
FD_ZERO(&fdreads);
|
565
586
|
FD_SET(kqfd, &fdreads);
|
566
587
|
|
567
588
|
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
|
589
|
+
#endif
|
568
590
|
if (ret == -1) {
|
569
591
|
assert(errno != EINVAL);
|
570
592
|
assert(errno != EBADF);
|
@@ -659,7 +681,9 @@ timeval EventMachine_t::_TimeTilNextEvent()
|
|
659
681
|
|
660
682
|
timeval tv;
|
661
683
|
|
662
|
-
if (
|
684
|
+
if (NumCloseScheduled > 0 || bTerminateSignalReceived) {
|
685
|
+
tv.tv_sec = tv.tv_usec = 0;
|
686
|
+
} else if (next_event == 0) {
|
663
687
|
tv = Quantum;
|
664
688
|
} else {
|
665
689
|
if (next_event > current_time) {
|
@@ -1377,6 +1401,14 @@ int EventMachine_t::DetachFD (EventableDescriptor *ed)
|
|
1377
1401
|
// Prevent the descriptor from being modified, in case DetachFD was called from a timer or next_tick
|
1378
1402
|
ModifiedDescriptors.erase (ed);
|
1379
1403
|
|
1404
|
+
// Prevent the descriptor from being added, in case DetachFD was called in the same tick as AttachFD
|
1405
|
+
for (size_t i = 0; i < NewDescriptors.size(); i++) {
|
1406
|
+
if (ed == NewDescriptors[i]) {
|
1407
|
+
NewDescriptors.erase(NewDescriptors.begin() + i);
|
1408
|
+
break;
|
1409
|
+
}
|
1410
|
+
}
|
1411
|
+
|
1380
1412
|
// Set MySocket = INVALID_SOCKET so ShouldDelete() is true (and the descriptor gets deleted and removed),
|
1381
1413
|
// and also to prevent anyone from calling close() on the detached fd
|
1382
1414
|
ed->SetSocketInvalid();
|
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(
|
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);
|
data/ext/extconf.rb
CHANGED
@@ -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('
|
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']
|
81
|
+
GNU_CHAIN = ENV['CROSS_COMPILING'] || $1 == 'mingw'
|
81
82
|
OS_WIN32 = true
|
82
83
|
add_define "OS_WIN32"
|
83
84
|
else
|
@@ -160,7 +161,7 @@ TRY_LINK.sub!('$(CC)', '$(CXX)')
|
|
160
161
|
add_define 'HAVE_MAKE_PAIR' if try_link(<<SRC, '-lstdc++')
|
161
162
|
#include <utility>
|
162
163
|
using namespace std;
|
163
|
-
int main(){ pair<int,int> tuple = make_pair(1,2); }
|
164
|
+
int main(){ pair<const int,int> tuple = make_pair(1,2); }
|
164
165
|
SRC
|
165
166
|
TRY_LINK.sub!('$(CXX)', '$(CC)')
|
166
167
|
|
@@ -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']
|
20
|
+
GNU_CHAIN = ENV['CROSS_COMPILING'] || $1 == 'mingw'
|
21
21
|
OS_WIN32 = true
|
22
22
|
add_define "OS_WIN32"
|
23
23
|
else
|
data/ext/rubymain.cpp
CHANGED
data/ext/ssl.cpp
CHANGED
@@ -478,7 +478,7 @@ extern "C" int ssl_verify_wrapper(int preverify_ok, X509_STORE_CTX *ctx)
|
|
478
478
|
|
479
479
|
ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject(binding));
|
480
480
|
result = (cd->VerifySslPeer(buf->data) == true ? 1 : 0);
|
481
|
-
|
481
|
+
BIO_free(out);
|
482
482
|
|
483
483
|
return result;
|
484
484
|
}
|
data/lib/em/processes.rb
CHANGED
@@ -114,7 +114,7 @@ module EventMachine
|
|
114
114
|
init = args.pop if args.last.is_a? Proc
|
115
115
|
|
116
116
|
# merge remaining arguments into the command
|
117
|
-
cmd =
|
117
|
+
cmd = [cmd, *args] if args.any?
|
118
118
|
|
119
119
|
EM.get_subprocess_pid(EM.popen(cmd, SystemCmd, cb) do |c|
|
120
120
|
init[c] if init
|
@@ -127,7 +127,7 @@ module EventMachine
|
|
127
127
|
# Allow an override for the host header if it's not the connect-string.
|
128
128
|
host = args[:host_header] || args[:host] || "_"
|
129
129
|
# For now, ALWAYS tuck in the port string, although we may want to omit it if it's the default.
|
130
|
-
port = args[:port]
|
130
|
+
port = args[:port].to_i != 80 ? ":#{args[:port]}" : ""
|
131
131
|
|
132
132
|
# POST items.
|
133
133
|
postcontenttype = args[:contenttype] || "application/octet-stream"
|
@@ -138,7 +138,7 @@ module EventMachine
|
|
138
138
|
# TODO: We ASSUME the caller wants to send a 1.1 request. May not be a good assumption.
|
139
139
|
req = [
|
140
140
|
"#{verb} #{request}#{qs} HTTP/#{version}",
|
141
|
-
"Host: #{host}
|
141
|
+
"Host: #{host}#{port}",
|
142
142
|
"User-agent: Ruby EventMachine",
|
143
143
|
]
|
144
144
|
|
@@ -529,11 +529,13 @@ module EventMachine
|
|
529
529
|
# Since we clear the chunk array every time we submit it, the caller needs to be
|
530
530
|
# aware to do things like dup it if he wants to keep it around across calls.
|
531
531
|
#
|
532
|
-
#
|
533
|
-
#
|
534
|
-
#
|
535
|
-
#
|
536
|
-
#
|
532
|
+
# Resets the transaction upon disposition of the incoming message.
|
533
|
+
# RFC5321 says this about the MAIL FROM command:
|
534
|
+
# "This command tells the SMTP-receiver that a new mail transaction is
|
535
|
+
# starting and to reset all its state tables and buffers, including any
|
536
|
+
# recipients or mail data."
|
537
|
+
#
|
538
|
+
# Equivalent behaviour is implemented by resetting after a completed transaction.
|
537
539
|
#
|
538
540
|
# User-written code can return a Deferrable as a response from receive_message.
|
539
541
|
#
|
@@ -547,9 +549,11 @@ module EventMachine
|
|
547
549
|
|
548
550
|
succeeded = proc {
|
549
551
|
send_data "250 Message accepted\r\n"
|
552
|
+
reset_protocol_state
|
550
553
|
}
|
551
554
|
failed = proc {
|
552
555
|
send_data "550 Message rejected\r\n"
|
556
|
+
reset_protocol_state
|
553
557
|
}
|
554
558
|
|
555
559
|
d = receive_message
|
data/lib/em/protocols/stomp.rb
CHANGED
@@ -104,12 +104,15 @@ module EventMachine
|
|
104
104
|
|
105
105
|
# @private
|
106
106
|
def send_frame verb, headers={}, body=""
|
107
|
+
body = body.to_s
|
107
108
|
ary = [verb, "\n"]
|
109
|
+
body_bytesize = body.bytesize if body.respond_to? :bytesize
|
110
|
+
body_bytesize ||= body.size
|
108
111
|
headers.each {|k,v| ary << "#{k}:#{v}\n" }
|
109
|
-
ary << "content-length: #{
|
112
|
+
ary << "content-length: #{body_bytesize}\n"
|
110
113
|
ary << "content-type: text/plain; charset=UTF-8\n" unless headers.has_key? 'content-type'
|
111
114
|
ary << "\n"
|
112
|
-
ary << body
|
115
|
+
ary << body
|
113
116
|
ary << "\0"
|
114
117
|
send_data ary.join
|
115
118
|
end
|
data/lib/em/version.rb
CHANGED
data/lib/eventmachine.rb
CHANGED
@@ -1172,7 +1172,12 @@ module EventMachine
|
|
1172
1172
|
# Perhaps misnamed since the underlying function uses socketpair and is full-duplex.
|
1173
1173
|
|
1174
1174
|
klass = klass_from_handler(Connection, handler, *args)
|
1175
|
-
w =
|
1175
|
+
w = case cmd
|
1176
|
+
when Array
|
1177
|
+
cmd
|
1178
|
+
when String
|
1179
|
+
Shellwords::shellwords( cmd )
|
1180
|
+
end
|
1176
1181
|
w.unshift( w.first ) if w.first
|
1177
1182
|
s = invoke_popen( w )
|
1178
1183
|
c = klass.new s, *args
|
data/rakelib/package.rake
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'rubygems/package_task'
|
3
|
+
|
2
4
|
begin
|
3
5
|
require 'rake/extensiontask'
|
4
6
|
require 'rake/javaextensiontask'
|
@@ -24,24 +26,32 @@ else
|
|
24
26
|
unless RUBY_PLATFORM =~ /mswin|mingw/
|
25
27
|
ext.cross_compile = true
|
26
28
|
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
end
|
30
|
+
end
|
31
|
+
def hack_cross_compilation(ext)
|
32
|
+
# inject 1.8/1.9 pure-ruby entry point
|
33
|
+
# HACK: add these dependencies to the task instead of using cross_compiling
|
34
|
+
ext.cross_platform.each do |platform|
|
35
|
+
task = "native:#{GEMSPEC.name}:#{platform}"
|
36
|
+
if Rake::Task.task_defined?(task)
|
37
|
+
Rake::Task[task].prerequisites.unshift "lib/#{ext.name}.rb"
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
35
|
-
Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
|
42
|
+
em = Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
|
36
43
|
ext.ext_dir = 'ext'
|
37
44
|
ext.source_pattern = '*.{h,c,cpp}'
|
38
45
|
setup_cross_compilation(ext)
|
39
46
|
end
|
40
|
-
|
47
|
+
hack_cross_compilation em
|
48
|
+
|
49
|
+
ff = Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
|
41
50
|
ext.ext_dir = 'ext/fastfilereader'
|
42
51
|
ext.source_pattern = '*.{h,c,cpp}'
|
43
52
|
setup_cross_compilation(ext)
|
44
53
|
end
|
54
|
+
hack_cross_compilation ff
|
45
55
|
end
|
46
56
|
|
47
57
|
# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems
|
@@ -83,16 +93,4 @@ def gem_cmd(action, name, *args)
|
|
83
93
|
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
|
84
94
|
end
|
85
95
|
|
86
|
-
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
|
96
|
+
Rake::Task[:clean].enhance [:clobber_package]
|
data/tests/test_epoll.rb
CHANGED
@@ -130,5 +130,20 @@ class TestEpoll < Test::Unit::TestCase
|
|
130
130
|
File.unlink(fn) if File.exist?(fn)
|
131
131
|
end
|
132
132
|
|
133
|
+
def test_attach_detach
|
134
|
+
EM.epoll
|
135
|
+
EM.run {
|
136
|
+
EM.add_timer(0.01) { EM.stop }
|
137
|
+
|
138
|
+
r = IO.pipe[0]
|
139
|
+
|
140
|
+
# This tests a regression where detach in the same tick as attach crashes EM
|
141
|
+
EM.watch(r) do |connection|
|
142
|
+
connection.detach
|
143
|
+
end
|
144
|
+
}
|
145
|
+
|
146
|
+
assert true
|
147
|
+
end
|
133
148
|
end
|
134
149
|
|
@@ -9,15 +9,17 @@ class TestIdleConnection < Test::Unit::TestCase
|
|
9
9
|
$idle_time = conn.get_idle_time
|
10
10
|
conn.send_data "GET / HTTP/1.0\r\n\r\n"
|
11
11
|
EM.next_tick{
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
EM.next_tick{
|
13
|
+
$idle_time_after_send = conn.get_idle_time
|
14
|
+
conn.close_connection
|
15
|
+
EM.stop
|
16
|
+
}
|
15
17
|
}
|
16
18
|
}
|
17
19
|
}
|
18
20
|
|
19
21
|
assert_in_delta 3, $idle_time, 0.2
|
20
|
-
|
22
|
+
assert_in_delta 0, $idle_time_after_send, 0.1
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
data/tests/test_ipv6.rb
CHANGED
@@ -4,14 +4,14 @@ class TestIPv6 < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
if Test::Unit::TestCase.public_ipv6?
|
6
6
|
|
7
|
-
# Tries to connect to ipv6.google.com (2a00:1450:
|
7
|
+
# Tries to connect to ipv6.google.com (2a00:1450:4007:804::1011) port 80 via TCP.
|
8
8
|
# Timeout in 6 seconds.
|
9
9
|
def test_ipv6_tcp_client_with_ipv6_google_com
|
10
10
|
conn = nil
|
11
11
|
setup_timeout(6)
|
12
12
|
|
13
13
|
EM.run do
|
14
|
-
conn = EM::connect("2a00:1450:
|
14
|
+
conn = EM::connect("2a00:1450:4007:804::1011", 80) do |c|
|
15
15
|
def c.connected
|
16
16
|
@connected
|
17
17
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'em_test_helper'
|
3
|
+
|
4
|
+
class TestSystem < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@filename = File.expand_path("../я манал dump.txt", __FILE__)
|
7
|
+
@test_data = 'a' * 100
|
8
|
+
File.open(@filename, 'w'){|f| f.write(@test_data)}
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_system
|
12
|
+
result = nil
|
13
|
+
status = nil
|
14
|
+
EM.run {
|
15
|
+
EM.system('cat', @filename){|out, state|
|
16
|
+
result = out
|
17
|
+
status = state.exitstatus
|
18
|
+
EM.stop
|
19
|
+
}
|
20
|
+
}
|
21
|
+
assert_equal(0, status)
|
22
|
+
assert_equal(@test_data, result)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_system_with_string
|
26
|
+
result = nil
|
27
|
+
status = nil
|
28
|
+
EM.run {
|
29
|
+
EM.system("cat '#@filename'"){|out, state|
|
30
|
+
result = out
|
31
|
+
status = state.exitstatus
|
32
|
+
EM.stop
|
33
|
+
}
|
34
|
+
}
|
35
|
+
assert_equal(0, status)
|
36
|
+
assert_equal(@test_data, result)
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
File.unlink(@filename)
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventmachine-le
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,33 +11,43 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake-compiler
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.8.3
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.8.3
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: yard
|
29
|
-
requirement:
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
30
35
|
none: false
|
31
36
|
requirements:
|
32
37
|
- - ! '>='
|
33
38
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
39
|
+
version: 0.8.5.2
|
35
40
|
type: :development
|
36
41
|
prerelease: false
|
37
|
-
version_requirements:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.8.5.2
|
38
48
|
- !ruby/object:Gem::Dependency
|
39
49
|
name: bluecloth
|
40
|
-
requirement:
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
41
51
|
none: false
|
42
52
|
requirements:
|
43
53
|
- - ! '>='
|
@@ -45,7 +55,12 @@ dependencies:
|
|
45
55
|
version: '0'
|
46
56
|
type: :development
|
47
57
|
prerelease: false
|
48
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
49
64
|
description: ! 'EventMachine-LE (Live Edition) is a branch of EventMachine (https://github.com/eventmachine/eventmachine).
|
50
65
|
|
51
66
|
|
@@ -213,6 +228,7 @@ extra_rdoc_files:
|
|
213
228
|
- tests/test_ssl_cipher_list.rb
|
214
229
|
- tests/test_ssl_methods.rb
|
215
230
|
- tests/test_ssl_verify.rb
|
231
|
+
- tests/test_system.rb
|
216
232
|
- tests/test_threaded_resource.rb
|
217
233
|
- tests/test_tick_loop.rb
|
218
234
|
- tests/test_timers.rb
|
@@ -346,6 +362,7 @@ files:
|
|
346
362
|
- tests/test_ssl_cipher_list.rb
|
347
363
|
- tests/test_ssl_methods.rb
|
348
364
|
- tests/test_ssl_verify.rb
|
365
|
+
- tests/test_system.rb
|
349
366
|
- tests/test_threaded_resource.rb
|
350
367
|
- tests/test_tick_loop.rb
|
351
368
|
- tests/test_timers.rb
|
@@ -353,7 +370,9 @@ files:
|
|
353
370
|
- tests/test_udp46.rb
|
354
371
|
- tests/test_unbind_reason.rb
|
355
372
|
homepage: https://github.com/ibc/EventMachine-LE/
|
356
|
-
licenses:
|
373
|
+
licenses:
|
374
|
+
- Ruby
|
375
|
+
- GPL
|
357
376
|
post_install_message:
|
358
377
|
rdoc_options:
|
359
378
|
- --title
|
@@ -378,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
378
397
|
version: '0'
|
379
398
|
requirements: []
|
380
399
|
rubyforge_project:
|
381
|
-
rubygems_version: 1.8.
|
400
|
+
rubygems_version: 1.8.23
|
382
401
|
signing_key:
|
383
402
|
specification_version: 3
|
384
403
|
summary: EventMachine LE (Live Edition)
|