eventmachine 0.5.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
+
@@ -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
+