eventmachine 0.5.3 → 0.7.0
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.
- data/RELEASE_NOTES +14 -1
- data/TODO +10 -0
- data/ext/cmain.cpp +100 -4
- data/ext/ed.cpp +228 -44
- data/ext/ed.h +25 -2
- data/ext/em.cpp +351 -14
- data/ext/em.h +33 -8
- data/ext/emwin.h +4 -2
- data/ext/eventmachine.h +9 -1
- data/ext/files.cpp +101 -0
- data/ext/files.h +72 -0
- data/ext/project.h +3 -1
- data/ext/rubymain.cpp +113 -5
- data/lib/em/deferrable.rb +89 -0
- data/lib/em/eventable.rb +50 -0
- data/lib/eventmachine.rb +274 -9
- data/lib/eventmachine_version.rb +42 -0
- data/lib/evma/callback.rb +35 -0
- data/lib/evma/container.rb +77 -0
- data/lib/evma/factory.rb +80 -0
- data/lib/evma/protocol.rb +89 -0
- data/lib/evma/reactor.rb +50 -0
- data/lib/evma.rb +35 -0
- data/lib/pr_eventmachine.rb +714 -0
- data/lib/protocols/header_and_content.rb +134 -0
- data/lib/protocols/httpclient.rb +233 -0
- data/lib/protocols/line_and_text.rb +141 -0
- data/lib/protocols/tcptest.rb +67 -0
- data/tests/test_basic.rb +106 -0
- data/tests/test_eventables.rb +85 -0
- data/tests/test_hc.rb +207 -0
- data/tests/test_httpclient.rb +94 -0
- data/tests/test_ltp.rb +192 -0
- data/tests/test_ud.rb +52 -0
- metadata +44 -18
- data/ext/Makefile +0 -139
- data/ext/mkmf.log +0 -59
@@ -0,0 +1,89 @@
|
|
1
|
+
# $Id: protocol.rb 90 2006-05-19 04:58:15Z blackhedd $
|
2
|
+
#
|
3
|
+
# Homepage:: http://rubyeventmachine.com
|
4
|
+
# Copyright:: (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
5
|
+
# Email:: gmail address: garbagecat10
|
6
|
+
#
|
7
|
+
# Available under the GNU Lesser General Public License.
|
8
|
+
# See the file COPYING in the distribution for full licensing information.
|
9
|
+
#-------------------------------------------------------------------
|
10
|
+
# This file is part of Ruby/EventMachine.
|
11
|
+
#
|
12
|
+
# Ruby/EventMachine is free software; you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
14
|
+
# the Free Software Foundation; either version 2.1 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
#
|
17
|
+
# Ruby/EventMachine is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
# GNU Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public License
|
23
|
+
# along with Ruby/EventMachine; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25
|
+
#-------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
module Evma
|
29
|
+
class Protocol
|
30
|
+
|
31
|
+
attr_reader :signature
|
32
|
+
|
33
|
+
def initialize sig
|
34
|
+
@signature = sig
|
35
|
+
end
|
36
|
+
|
37
|
+
def unbind
|
38
|
+
end
|
39
|
+
|
40
|
+
def close
|
41
|
+
Evma::Reactor.instance # ensure initialized
|
42
|
+
EventMachine.close_connection signature, false
|
43
|
+
end
|
44
|
+
|
45
|
+
def close_after_writing
|
46
|
+
Evma::Reactor.instance # ensure initialized
|
47
|
+
EventMachine.close_connection signature, true
|
48
|
+
end
|
49
|
+
|
50
|
+
end # class Protocol
|
51
|
+
end # module Evma
|
52
|
+
|
53
|
+
|
54
|
+
###########################################
|
55
|
+
|
56
|
+
module Evma
|
57
|
+
class StreamProtocol < Protocol
|
58
|
+
|
59
|
+
def initialize sig
|
60
|
+
super
|
61
|
+
end
|
62
|
+
|
63
|
+
def send_data data
|
64
|
+
Evma::Reactor.instance # ensure initialized
|
65
|
+
EventMachine.send_data signature, data, data.length
|
66
|
+
end
|
67
|
+
|
68
|
+
end # class Protocol
|
69
|
+
end # module Evma
|
70
|
+
|
71
|
+
|
72
|
+
###########################################
|
73
|
+
|
74
|
+
module Evma
|
75
|
+
class DatagramProtocol < Protocol
|
76
|
+
|
77
|
+
def initialize sig
|
78
|
+
super
|
79
|
+
end
|
80
|
+
|
81
|
+
def send_message data
|
82
|
+
Evma::Reactor.instance # ensure initialized
|
83
|
+
raise "unimplemented"
|
84
|
+
end
|
85
|
+
|
86
|
+
end # class Protocol
|
87
|
+
end # module Evma
|
88
|
+
|
89
|
+
|
data/lib/evma/reactor.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# $Id: reactor.rb 83 2006-05-18 21:36:31Z blackhedd $
|
2
|
+
#
|
3
|
+
# Homepage:: http://rubyeventmachine.com
|
4
|
+
# Copyright:: (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
5
|
+
# Email:: gmail address: garbagecat10
|
6
|
+
#
|
7
|
+
# Available under the GNU Lesser General Public License.
|
8
|
+
# See the file COPYING in the distribution for full licensing information.
|
9
|
+
#-------------------------------------------------------------------
|
10
|
+
# This file is part of Ruby/EventMachine.
|
11
|
+
#
|
12
|
+
# Ruby/EventMachine is free software; you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
14
|
+
# the Free Software Foundation; either version 2.1 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
#
|
17
|
+
# Ruby/EventMachine is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
# GNU Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public License
|
23
|
+
# along with Ruby/EventMachine; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25
|
+
#-------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
|
29
|
+
require 'singleton'
|
30
|
+
|
31
|
+
module Evma
|
32
|
+
class Reactor
|
33
|
+
include Singleton
|
34
|
+
|
35
|
+
#--
|
36
|
+
def initialize
|
37
|
+
EventMachine.initialize_event_machine
|
38
|
+
end
|
39
|
+
|
40
|
+
#--
|
41
|
+
#
|
42
|
+
def run
|
43
|
+
EventMachine.run_machine
|
44
|
+
end
|
45
|
+
|
46
|
+
end # class Reactor
|
47
|
+
end # module Evma
|
48
|
+
|
49
|
+
|
50
|
+
|
data/lib/evma.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# $Id: evma.rb 88 2006-05-19 03:42:54Z blackhedd $
|
2
|
+
#
|
3
|
+
# Homepage:: http://rubyeventmachine.com
|
4
|
+
# Copyright:: (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
5
|
+
# Email:: gmail address: garbagecat10
|
6
|
+
#
|
7
|
+
# Available under the GNU Lesser General Public License.
|
8
|
+
# See the file COPYING in the distribution for full licensing information.
|
9
|
+
#-------------------------------------------------------------------
|
10
|
+
# This file is part of Ruby/EventMachine.
|
11
|
+
#
|
12
|
+
# Ruby/EventMachine is free software; you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
14
|
+
# the Free Software Foundation; either version 2.1 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
#
|
17
|
+
# Ruby/EventMachine is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
# GNU Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public License
|
23
|
+
# along with Ruby/EventMachine; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25
|
+
#-------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
|
29
|
+
require 'rubyeventmachine'
|
30
|
+
require 'evma/reactor'
|
31
|
+
require 'evma/callback'
|
32
|
+
require 'evma/protocol'
|
33
|
+
require 'evma/factory'
|
34
|
+
require 'evma/container'
|
35
|
+
|