eventmachine 0.3.1
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/COPYING +281 -0
- data/README +69 -0
- data/RELEASE_NOTES +18 -0
- data/doc/classes/Echo.html +180 -0
- data/doc/classes/Echo.src/M000033.html +23 -0
- data/doc/classes/Echo.src/M000034.html +19 -0
- data/doc/classes/Echo.src/M000035.html +19 -0
- data/doc/classes/Echo.src/M000036.html +18 -0
- data/doc/classes/EventMachine.html +369 -0
- data/doc/classes/EventMachine.src/M000002.html +24 -0
- data/doc/classes/EventMachine.src/M000003.html +24 -0
- data/doc/classes/EventMachine.src/M000004.html +26 -0
- data/doc/classes/EventMachine.src/M000005.html +21 -0
- data/doc/classes/EventMachine.src/M000006.html +23 -0
- data/doc/classes/EventMachine.src/M000007.html +28 -0
- data/doc/classes/EventMachine.src/M000008.html +20 -0
- data/doc/classes/EventMachine.src/M000009.html +19 -0
- data/doc/classes/EventMachine.src/M000010.html +18 -0
- data/doc/classes/EventMachine.src/M000011.html +18 -0
- data/doc/classes/EventMachine/Connection.html +341 -0
- data/doc/classes/EventMachine/Connection.src/M000020.html +19 -0
- data/doc/classes/EventMachine/Connection.src/M000021.html +17 -0
- data/doc/classes/EventMachine/Connection.src/M000022.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000023.html +17 -0
- data/doc/classes/EventMachine/Connection.src/M000024.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000025.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000026.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000027.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000028.html +17 -0
- data/doc/classes/EventMachine/Connection.src/M000029.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000030.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000031.html +18 -0
- data/doc/classes/EventMachine/Connection.src/M000032.html +18 -0
- data/doc/classes/EventMachine/ConnectionAlreadyBound.html +111 -0
- data/doc/classes/EventMachine/ConnectionNotBound.html +111 -0
- data/doc/classes/EventMachine/Connections.html +292 -0
- data/doc/classes/EventMachine/Connections.src/M000012.html +20 -0
- data/doc/classes/EventMachine/Connections.src/M000013.html +23 -0
- data/doc/classes/EventMachine/Connections.src/M000014.html +23 -0
- data/doc/classes/EventMachine/Connections.src/M000015.html +24 -0
- data/doc/classes/EventMachine/Connections.src/M000016.html +19 -0
- data/doc/classes/EventMachine/Connections.src/M000017.html +21 -0
- data/doc/classes/EventMachine/Connections.src/M000018.html +19 -0
- data/doc/classes/EventMachine/Connections.src/M000019.html +20 -0
- data/doc/classes/EventMachine/EventCodes.html +133 -0
- data/doc/classes/EventMachine/NoConnectionMade.html +111 -0
- data/doc/classes/EventMachine/NoHandlerForAcceptedConnection.html +111 -0
- data/doc/classes/EventMachine/NoServerCreated.html +111 -0
- data/doc/classes/EventMachine/TimerNotInstalled.html +111 -0
- data/doc/classes/EventMachine/TooManyAcceptors.html +111 -0
- data/doc/classes/EventMachine/TooManyTimersPending.html +111 -0
- data/doc/classes/EventMachine/UnknownTimerFired.html +111 -0
- data/doc/classes/Zzz.html +131 -0
- data/doc/classes/Zzz.src/M000001.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/binder_cpp.html +101 -0
- data/doc/files/ed_cpp.html +101 -0
- data/doc/files/em_cpp.html +101 -0
- data/doc/files/event_machine_rb.html +118 -0
- data/doc/files/g_rb.html +108 -0
- data/doc/files/lib/eventmachine_rb.html +114 -0
- data/doc/files/libmain_cpp.html +101 -0
- data/doc/files/sigs_cpp.html +101 -0
- data/doc/files/tests/testem_rb.html +110 -0
- data/doc/fr_class_index.html +41 -0
- data/doc/fr_file_index.html +35 -0
- data/doc/fr_method_index.html +62 -0
- data/doc/index.html +24 -0
- data/ext/libeventmachine.so +0 -0
- data/lib/eventmachine.rb +631 -0
- data/tests/testem.rb +5 -0
- metadata +121 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: EventMachine::Connections</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">EventMachine::Connections</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/event_machine_rb.html">
|
|
59
|
+
event_machine.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
Object
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div id="method-list">
|
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
|
87
|
+
|
|
88
|
+
<div class="name-list">
|
|
89
|
+
<a href="#M000019">accept_connection</a>
|
|
90
|
+
<a href="#M000017">add_timer</a>
|
|
91
|
+
<a href="#M000013">connect</a>
|
|
92
|
+
<a href="#M000012">new</a>
|
|
93
|
+
<a href="#M000016">receive_data</a>
|
|
94
|
+
<a href="#M000018">run_timer</a>
|
|
95
|
+
<a href="#M000014">start_server</a>
|
|
96
|
+
<a href="#M000015">unbind_connection</a>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
<!-- if includes -->
|
|
104
|
+
<div id="includes">
|
|
105
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
106
|
+
|
|
107
|
+
<div id="includes-list">
|
|
108
|
+
<span class="include-name">Singleton</span>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div id="section">
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<!-- if method_list -->
|
|
122
|
+
<div id="methods">
|
|
123
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
124
|
+
|
|
125
|
+
<div id="method-M000012" class="method-detail">
|
|
126
|
+
<a name="M000012"></a>
|
|
127
|
+
|
|
128
|
+
<div class="method-heading">
|
|
129
|
+
<a href="Connections.src/M000012.html" target="Code" class="method-signature"
|
|
130
|
+
onclick="popupCode('Connections.src/M000012.html');return false;">
|
|
131
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
|
132
|
+
</a>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<div class="method-description">
|
|
136
|
+
<p>
|
|
137
|
+
initialize
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
143
|
+
|
|
144
|
+
<div id="method-M000019" class="method-detail">
|
|
145
|
+
<a name="M000019"></a>
|
|
146
|
+
|
|
147
|
+
<div class="method-heading">
|
|
148
|
+
<a href="Connections.src/M000019.html" target="Code" class="method-signature"
|
|
149
|
+
onclick="popupCode('Connections.src/M000019.html');return false;">
|
|
150
|
+
<span class="method-name">accept_connection</span><span class="method-args">(conn, data)</span>
|
|
151
|
+
</a>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="method-description">
|
|
155
|
+
<p>
|
|
156
|
+
<a href="Connections.html#M000019">accept_connection</a>
|
|
157
|
+
</p>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div id="method-M000017" class="method-detail">
|
|
162
|
+
<a name="M000017"></a>
|
|
163
|
+
|
|
164
|
+
<div class="method-heading">
|
|
165
|
+
<a href="Connections.src/M000017.html" target="Code" class="method-signature"
|
|
166
|
+
onclick="popupCode('Connections.src/M000017.html');return false;">
|
|
167
|
+
<span class="method-name">add_timer</span><span class="method-args">(interval, code)</span>
|
|
168
|
+
</a>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div class="method-description">
|
|
172
|
+
<p>
|
|
173
|
+
<a href="Connections.html#M000017">add_timer</a> Throwing an exception here
|
|
174
|
+
is a pretty bad idea. We don’t want the timer list to get too big but
|
|
175
|
+
wiping out the process is the wrong thing to do about it. The problem might
|
|
176
|
+
be caused by a runaway but not necessarily.
|
|
177
|
+
</p>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div id="method-M000013" class="method-detail">
|
|
182
|
+
<a name="M000013"></a>
|
|
183
|
+
|
|
184
|
+
<div class="method-heading">
|
|
185
|
+
<a href="Connections.src/M000013.html" target="Code" class="method-signature"
|
|
186
|
+
onclick="popupCode('Connections.src/M000013.html');return false;">
|
|
187
|
+
<span class="method-name">connect</span><span class="method-args">(server, port, handler)</span>
|
|
188
|
+
</a>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div class="method-description">
|
|
192
|
+
<p>
|
|
193
|
+
connect This code builds in an assumption of single-threadedness. We call
|
|
194
|
+
libgirr2 to set up a connection object for us, and it passes us back the
|
|
195
|
+
connection binding assigned inside of girr2. We then use that binding to
|
|
196
|
+
create an index to a newly-created <a href="Connection.html">Connection</a>
|
|
197
|
+
object. The assumption is that no events from the libgirr2 will fire
|
|
198
|
+
against that connection (on some other thread) before we’ve added it
|
|
199
|
+
to our internal connection list, otherwise those events will raise an
|
|
200
|
+
unbound-connection error. Return the new connection to the caller.
|
|
201
|
+
</p>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<div id="method-M000016" class="method-detail">
|
|
206
|
+
<a name="M000016"></a>
|
|
207
|
+
|
|
208
|
+
<div class="method-heading">
|
|
209
|
+
<a href="Connections.src/M000016.html" target="Code" class="method-signature"
|
|
210
|
+
onclick="popupCode('Connections.src/M000016.html');return false;">
|
|
211
|
+
<span class="method-name">receive_data</span><span class="method-args">(conn, data)</span>
|
|
212
|
+
</a>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<div class="method-description">
|
|
216
|
+
<p>
|
|
217
|
+
<a href="Connections.html#M000016">receive_data</a>
|
|
218
|
+
</p>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div id="method-M000018" class="method-detail">
|
|
223
|
+
<a name="M000018"></a>
|
|
224
|
+
|
|
225
|
+
<div class="method-heading">
|
|
226
|
+
<a href="Connections.src/M000018.html" target="Code" class="method-signature"
|
|
227
|
+
onclick="popupCode('Connections.src/M000018.html');return false;">
|
|
228
|
+
<span class="method-name">run_timer</span><span class="method-args">(str)</span>
|
|
229
|
+
</a>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div class="method-description">
|
|
233
|
+
<p>
|
|
234
|
+
<a href="Connections.html#M000018">run_timer</a>
|
|
235
|
+
</p>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<div id="method-M000014" class="method-detail">
|
|
240
|
+
<a name="M000014"></a>
|
|
241
|
+
|
|
242
|
+
<div class="method-heading">
|
|
243
|
+
<a href="Connections.src/M000014.html" target="Code" class="method-signature"
|
|
244
|
+
onclick="popupCode('Connections.src/M000014.html');return false;">
|
|
245
|
+
<span class="method-name">start_server</span><span class="method-args">(server, port, handler)</span>
|
|
246
|
+
</a>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
<div class="method-description">
|
|
250
|
+
<p>
|
|
251
|
+
<a href="Connections.html#M000014">start_server</a> Throttle the number of
|
|
252
|
+
acceptors. THERE IS CURRENTLY NO PROVISION for acceptors ever to be
|
|
253
|
+
deleted. Once created, they stick around forever. Also, libgirr2 implicitly
|
|
254
|
+
assumes they never encounter fatal errors. Would eventually be nice to
|
|
255
|
+
allow for closing an acceptor. libgirr2 sends us an event whenever an
|
|
256
|
+
acceptor creates a new connection, and it sends us both the acceptor
|
|
257
|
+
binding and the binding of the new connection so we can instantiate a
|
|
258
|
+
handler object of the type created here.
|
|
259
|
+
</p>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div id="method-M000015" class="method-detail">
|
|
264
|
+
<a name="M000015"></a>
|
|
265
|
+
|
|
266
|
+
<div class="method-heading">
|
|
267
|
+
<a href="Connections.src/M000015.html" target="Code" class="method-signature"
|
|
268
|
+
onclick="popupCode('Connections.src/M000015.html');return false;">
|
|
269
|
+
<span class="method-name">unbind_connection</span><span class="method-args">(conn)</span>
|
|
270
|
+
</a>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div class="method-description">
|
|
274
|
+
<p>
|
|
275
|
+
<a href="Connections.html#M000015">unbind_connection</a>
|
|
276
|
+
</p>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
<div id="validator-badges">
|
|
288
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
</body>
|
|
292
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>new (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 108</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
|
15
|
+
<span class="ruby-ivar">@conns</span> = {}
|
|
16
|
+
<span class="ruby-ivar">@acceptors</span> = {}
|
|
17
|
+
<span class="ruby-ivar">@timers</span> = {}
|
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>connect (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 128</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span> <span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">handler</span>
|
|
15
|
+
<span class="ruby-identifier">r</span>,<span class="ruby-identifier">rs</span> = <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-identifier">connect_to_server</span> <span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>
|
|
16
|
+
(<span class="ruby-identifier">r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoConnectionMade</span>
|
|
17
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">r</span>
|
|
18
|
+
<span class="ruby-identifier">handler</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">extend</span> <span class="ruby-identifier">handler</span>
|
|
19
|
+
<span class="ruby-ivar">@conns</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-identifier">c</span>
|
|
20
|
+
<span class="ruby-identifier">c</span>
|
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>start_server (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 149</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_server</span> <span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">handler</span>
|
|
15
|
+
<span class="ruby-ivar">@acceptors</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1000</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">TooManyAcceptors</span>
|
|
16
|
+
<span class="ruby-identifier">r</span>,<span class="ruby-identifier">rs</span> = <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-identifier">create_tcp_server</span> <span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span>
|
|
17
|
+
(<span class="ruby-identifier">r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoServerCreated</span>
|
|
18
|
+
<span class="ruby-ivar">@acceptors</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">Connection</span> ) {
|
|
19
|
+
<span class="ruby-identifier">handler</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">include</span> <span class="ruby-identifier">handler</span>
|
|
20
|
+
}
|
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>unbind_connection (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 162</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbind_connection</span> <span class="ruby-identifier">conn</span>
|
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> = <span class="ruby-ivar">@conns</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">conn</span> )
|
|
16
|
+
<span class="ruby-identifier">c</span>.<span class="ruby-identifier">unbind</span>
|
|
17
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">a</span> = <span class="ruby-ivar">@acceptors</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">conn</span> )
|
|
18
|
+
<span class="ruby-comment cmt"># no-op</span>
|
|
19
|
+
<span class="ruby-keyword kw">else</span>
|
|
20
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ConnectionNotBound</span>
|
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>receive_data (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 175</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">receive_data</span> <span class="ruby-identifier">conn</span>, <span class="ruby-identifier">data</span>
|
|
15
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@conns</span>[<span class="ruby-identifier">conn</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ConnectionNotBound</span>
|
|
16
|
+
<span class="ruby-identifier">c</span>.<span class="ruby-identifier">receive_data</span> <span class="ruby-identifier">data</span>
|
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>add_timer (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 188</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_timer</span> <span class="ruby-identifier">interval</span>, <span class="ruby-identifier">code</span>
|
|
15
|
+
<span class="ruby-ivar">@timers</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1000</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">TooManyTimersPending</span>
|
|
16
|
+
<span class="ruby-identifier">r</span>,<span class="ruby-identifier">rs</span> = <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-constant">InstallOneshotTimer</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">interval</span>.<span class="ruby-identifier">to_i</span>
|
|
17
|
+
(<span class="ruby-identifier">r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">TimerNotInstalled</span>
|
|
18
|
+
<span class="ruby-ivar">@timers</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-identifier">code</span>
|
|
19
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>run_timer (EventMachine::Connections)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File event_machine.rb, line 198</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_timer</span> <span class="ruby-identifier">str</span>
|
|
15
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-ivar">@timers</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">str</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnknownTimerFired</span>
|
|
16
|
+
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">call</span>
|
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|