eventmachine 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +44 -265
- data/GNU +281 -0
- data/LEGAL +25 -0
- data/README +5 -3
- data/RELEASE_NOTES +7 -2
- data/ext/binder.cpp +8 -15
- data/ext/binder.h +8 -15
- data/ext/cmain.cpp +29 -15
- data/ext/ed.cpp +36 -43
- data/ext/ed.h +8 -15
- data/ext/em.cpp +116 -21
- data/ext/em.h +11 -16
- data/ext/emwin.cpp +9 -16
- data/ext/emwin.h +9 -16
- data/ext/eventmachine.h +9 -14
- data/ext/extconf.rb +9 -17
- data/ext/files.cpp +7 -14
- data/ext/files.h +7 -14
- data/ext/page.cpp +8 -15
- data/ext/page.h +8 -15
- data/ext/project.h +15 -15
- data/ext/rubymain.cpp +37 -16
- data/ext/sigs.cpp +8 -15
- data/ext/sigs.h +8 -15
- data/ext/ssl.cpp +8 -15
- data/ext/ssl.h +8 -15
- data/lib/em/deferrable.rb +40 -27
- data/lib/em/eventable.rb +12 -23
- data/lib/em/future.rb +62 -0
- data/lib/eventmachine.rb +156 -66
- data/lib/eventmachine_version.rb +12 -23
- data/lib/evma.rb +15 -18
- data/lib/evma/callback.rb +16 -19
- data/lib/evma/container.rb +17 -19
- data/lib/evma/factory.rb +16 -19
- data/lib/evma/protocol.rb +17 -19
- data/lib/evma/reactor.rb +17 -19
- data/lib/pr_eventmachine.rb +12 -23
- data/lib/protocols/buftok.rb +121 -0
- data/lib/protocols/header_and_content.rb +12 -23
- data/lib/protocols/httpclient.rb +44 -31
- data/lib/protocols/line_and_text.rb +97 -118
- data/lib/protocols/tcptest.rb +12 -22
- data/tests/test_basic.rb +14 -24
- data/tests/test_eventables.rb +14 -24
- data/tests/test_exc.rb +57 -0
- data/tests/test_futures.rb +136 -0
- data/tests/test_hc.rb +14 -24
- data/tests/test_httpclient.rb +106 -25
- data/tests/test_ltp.rb +14 -23
- data/tests/test_timers.rb +109 -0
- data/tests/test_ud.rb +14 -24
- metadata +11 -2
data/tests/test_ltp.rb
CHANGED
@@ -1,36 +1,27 @@
|
|
1
|
-
# $Id: test_ltp.rb
|
2
|
-
#
|
3
|
-
# Author:: blackhedd (gmail address: garbagecat10).
|
4
|
-
# Date:: 8 Apr 2006
|
5
|
-
#
|
6
|
-
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# This program is made available under the terms of the GPL version 2.
|
1
|
+
# $Id: test_ltp.rb 323 2007-05-22 22:22:43Z blackhedd $
|
9
2
|
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 8 April 2006
|
6
|
+
#
|
10
7
|
# See EventMachine and EventMachine::Connection for documentation and
|
11
8
|
# usage examples.
|
12
9
|
#
|
13
10
|
#----------------------------------------------------------------------------
|
14
11
|
#
|
15
|
-
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
19
15
|
# This program is free software; you can redistribute it and/or modify
|
20
|
-
# it under the terms of the GNU General Public License
|
21
|
-
# the Free Software Foundation; either version 2 of the
|
22
|
-
# (at your option) any later version.
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
23
21
|
#
|
24
|
-
|
25
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27
|
-
# GNU General Public License for more details.
|
22
|
+
#---------------------------------------------------------------------------
|
28
23
|
#
|
29
|
-
# You should have received a copy of the GNU General Public License
|
30
|
-
# along with this program; if not, write to the Free Software
|
31
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
32
24
|
#
|
33
|
-
#---------------------------------------------------------------------------
|
34
25
|
#
|
35
26
|
#
|
36
27
|
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# $Id: test_timers.rb 323 2007-05-22 22:22:43Z blackhedd $
|
2
|
+
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 8 April 2006
|
6
|
+
#
|
7
|
+
# See EventMachine and EventMachine::Connection for documentation and
|
8
|
+
# usage examples.
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
21
|
+
#
|
22
|
+
#---------------------------------------------------------------------------
|
23
|
+
#
|
24
|
+
#
|
25
|
+
#
|
26
|
+
#
|
27
|
+
|
28
|
+
$:.unshift "../lib"
|
29
|
+
require 'eventmachine'
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
class TestTimers < Test::Unit::TestCase
|
34
|
+
|
35
|
+
def setup
|
36
|
+
end
|
37
|
+
|
38
|
+
def teardown
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_timer_with_block
|
42
|
+
x = false
|
43
|
+
EventMachine.run {
|
44
|
+
EventMachine::Timer.new(0.25) {
|
45
|
+
x = true
|
46
|
+
EventMachine.stop
|
47
|
+
}
|
48
|
+
}
|
49
|
+
assert x
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_timer_with_proc
|
53
|
+
x = false
|
54
|
+
EventMachine.run {
|
55
|
+
EventMachine::Timer.new(0.25, proc {
|
56
|
+
x = true
|
57
|
+
EventMachine.stop
|
58
|
+
})
|
59
|
+
}
|
60
|
+
assert x
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_timer_cancel
|
64
|
+
x = true
|
65
|
+
EventMachine.run {
|
66
|
+
timer = EventMachine::Timer.new(0.25, proc { x = false })
|
67
|
+
timer.cancel
|
68
|
+
EventMachine::Timer.new(0.5, proc {EventMachine.stop})
|
69
|
+
}
|
70
|
+
assert x
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_periodic_timer
|
74
|
+
x = 0
|
75
|
+
EventMachine.run {
|
76
|
+
EventMachine::PeriodicTimer.new(0.1, proc {
|
77
|
+
x += 1
|
78
|
+
EventMachine.stop if x == 4
|
79
|
+
})
|
80
|
+
}
|
81
|
+
assert( x == 4 )
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_periodic_timer_cancel
|
85
|
+
x = 0
|
86
|
+
EventMachine.run {
|
87
|
+
pt = EventMachine::PeriodicTimer.new(5, proc { x += 1 })
|
88
|
+
pt.cancel
|
89
|
+
EventMachine::Timer.new(0.5) {EventMachine.stop}
|
90
|
+
}
|
91
|
+
assert( x == 0 )
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_periodic_timer_self_cancel
|
95
|
+
x = 0
|
96
|
+
EventMachine.run {
|
97
|
+
pt = EventMachine::PeriodicTimer.new(0.1) {
|
98
|
+
x += 1
|
99
|
+
if x == 4
|
100
|
+
pt.cancel
|
101
|
+
EventMachine.stop
|
102
|
+
end
|
103
|
+
}
|
104
|
+
}
|
105
|
+
assert( x == 4 )
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
data/tests/test_ud.rb
CHANGED
@@ -1,38 +1,28 @@
|
|
1
|
-
# $Id: test_ud.rb
|
2
|
-
#
|
3
|
-
# Author:: blackhedd (gmail address: garbagecat10).
|
4
|
-
# Date:: 8 Apr 2006
|
5
|
-
#
|
6
|
-
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
7
|
-
#
|
8
|
-
# This program is made available under the terms of the GPL version 2.
|
1
|
+
# $Id: test_ud.rb 323 2007-05-22 22:22:43Z blackhedd $
|
9
2
|
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 8 April 2006
|
6
|
+
#
|
10
7
|
# See EventMachine and EventMachine::Connection for documentation and
|
11
8
|
# usage examples.
|
12
9
|
#
|
13
10
|
#----------------------------------------------------------------------------
|
14
11
|
#
|
15
|
-
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
19
15
|
# This program is free software; you can redistribute it and/or modify
|
20
|
-
# it under the terms of the GNU General Public License
|
21
|
-
# the Free Software Foundation; either version 2 of the
|
22
|
-
# (at your option) any later version.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27
|
-
# GNU General Public License for more details.
|
28
|
-
#
|
29
|
-
# You should have received a copy of the GNU General Public License
|
30
|
-
# along with this program; if not, write to the Free Software
|
31
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
32
21
|
#
|
33
22
|
#---------------------------------------------------------------------------
|
34
23
|
#
|
35
24
|
#
|
25
|
+
#
|
36
26
|
|
37
27
|
$:.unshift "../lib"
|
38
28
|
require 'eventmachine'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: eventmachine
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date:
|
6
|
+
version: 0.7.2
|
7
|
+
date: 2007-05-22 00:00:00 -04:00
|
8
8
|
summary: Ruby/EventMachine socket engine library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -36,6 +36,9 @@ files:
|
|
36
36
|
- tests/test_ud.rb
|
37
37
|
- tests/test_ltp.rb
|
38
38
|
- tests/test_hc.rb
|
39
|
+
- tests/test_futures.rb
|
40
|
+
- tests/test_exc.rb
|
41
|
+
- tests/test_timers.rb
|
39
42
|
- lib/em
|
40
43
|
- lib/protocols
|
41
44
|
- lib/evma
|
@@ -45,10 +48,12 @@ files:
|
|
45
48
|
- lib/eventmachine_version.rb
|
46
49
|
- lib/em/eventable.rb
|
47
50
|
- lib/em/deferrable.rb
|
51
|
+
- lib/em/future.rb
|
48
52
|
- lib/protocols/httpclient.rb
|
49
53
|
- lib/protocols/tcptest.rb
|
50
54
|
- lib/protocols/line_and_text.rb
|
51
55
|
- lib/protocols/header_and_content.rb
|
56
|
+
- lib/protocols/buftok.rb
|
52
57
|
- lib/evma/reactor.rb
|
53
58
|
- lib/evma/protocol.rb
|
54
59
|
- lib/evma/container.rb
|
@@ -78,6 +83,8 @@ files:
|
|
78
83
|
- README
|
79
84
|
- RELEASE_NOTES
|
80
85
|
- COPYING
|
86
|
+
- GNU
|
87
|
+
- LEGAL
|
81
88
|
- TODO
|
82
89
|
test_files:
|
83
90
|
- tests/testem.rb
|
@@ -91,6 +98,8 @@ extra_rdoc_files:
|
|
91
98
|
- README
|
92
99
|
- RELEASE_NOTES
|
93
100
|
- COPYING
|
101
|
+
- GNU
|
102
|
+
- LEGAL
|
94
103
|
- TODO
|
95
104
|
executables: []
|
96
105
|
|