eventmachine 0.3.1 → 0.4.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.
Files changed (80) hide show
  1. data/RELEASE_NOTES +5 -1
  2. data/ext/binder.cpp +125 -0
  3. data/ext/binder.h +54 -0
  4. data/ext/ed.cpp +528 -0
  5. data/ext/ed.h +152 -0
  6. data/ext/em.cpp +475 -0
  7. data/ext/em.h +90 -0
  8. data/ext/extconf.rb +31 -0
  9. data/ext/libmain.cpp +312 -0
  10. data/ext/project.h +63 -0
  11. data/ext/sigs.cpp +60 -0
  12. data/ext/sigs.h +35 -0
  13. data/lib/eventmachine.rb +39 -1
  14. metadata +18 -80
  15. data/doc/classes/Echo.html +0 -180
  16. data/doc/classes/Echo.src/M000033.html +0 -23
  17. data/doc/classes/Echo.src/M000034.html +0 -19
  18. data/doc/classes/Echo.src/M000035.html +0 -19
  19. data/doc/classes/Echo.src/M000036.html +0 -18
  20. data/doc/classes/EventMachine.html +0 -369
  21. data/doc/classes/EventMachine.src/M000002.html +0 -24
  22. data/doc/classes/EventMachine.src/M000003.html +0 -24
  23. data/doc/classes/EventMachine.src/M000004.html +0 -26
  24. data/doc/classes/EventMachine.src/M000005.html +0 -21
  25. data/doc/classes/EventMachine.src/M000006.html +0 -23
  26. data/doc/classes/EventMachine.src/M000007.html +0 -28
  27. data/doc/classes/EventMachine.src/M000008.html +0 -20
  28. data/doc/classes/EventMachine.src/M000009.html +0 -19
  29. data/doc/classes/EventMachine.src/M000010.html +0 -18
  30. data/doc/classes/EventMachine.src/M000011.html +0 -18
  31. data/doc/classes/EventMachine/Connection.html +0 -341
  32. data/doc/classes/EventMachine/Connection.src/M000020.html +0 -19
  33. data/doc/classes/EventMachine/Connection.src/M000021.html +0 -17
  34. data/doc/classes/EventMachine/Connection.src/M000022.html +0 -18
  35. data/doc/classes/EventMachine/Connection.src/M000023.html +0 -17
  36. data/doc/classes/EventMachine/Connection.src/M000024.html +0 -18
  37. data/doc/classes/EventMachine/Connection.src/M000025.html +0 -18
  38. data/doc/classes/EventMachine/Connection.src/M000026.html +0 -18
  39. data/doc/classes/EventMachine/Connection.src/M000027.html +0 -18
  40. data/doc/classes/EventMachine/Connection.src/M000028.html +0 -17
  41. data/doc/classes/EventMachine/Connection.src/M000029.html +0 -18
  42. data/doc/classes/EventMachine/Connection.src/M000030.html +0 -18
  43. data/doc/classes/EventMachine/Connection.src/M000031.html +0 -18
  44. data/doc/classes/EventMachine/Connection.src/M000032.html +0 -18
  45. data/doc/classes/EventMachine/ConnectionAlreadyBound.html +0 -111
  46. data/doc/classes/EventMachine/ConnectionNotBound.html +0 -111
  47. data/doc/classes/EventMachine/Connections.html +0 -292
  48. data/doc/classes/EventMachine/Connections.src/M000012.html +0 -20
  49. data/doc/classes/EventMachine/Connections.src/M000013.html +0 -23
  50. data/doc/classes/EventMachine/Connections.src/M000014.html +0 -23
  51. data/doc/classes/EventMachine/Connections.src/M000015.html +0 -24
  52. data/doc/classes/EventMachine/Connections.src/M000016.html +0 -19
  53. data/doc/classes/EventMachine/Connections.src/M000017.html +0 -21
  54. data/doc/classes/EventMachine/Connections.src/M000018.html +0 -19
  55. data/doc/classes/EventMachine/Connections.src/M000019.html +0 -20
  56. data/doc/classes/EventMachine/EventCodes.html +0 -133
  57. data/doc/classes/EventMachine/NoConnectionMade.html +0 -111
  58. data/doc/classes/EventMachine/NoHandlerForAcceptedConnection.html +0 -111
  59. data/doc/classes/EventMachine/NoServerCreated.html +0 -111
  60. data/doc/classes/EventMachine/TimerNotInstalled.html +0 -111
  61. data/doc/classes/EventMachine/TooManyAcceptors.html +0 -111
  62. data/doc/classes/EventMachine/TooManyTimersPending.html +0 -111
  63. data/doc/classes/EventMachine/UnknownTimerFired.html +0 -111
  64. data/doc/classes/Zzz.html +0 -131
  65. data/doc/classes/Zzz.src/M000001.html +0 -18
  66. data/doc/created.rid +0 -1
  67. data/doc/files/binder_cpp.html +0 -101
  68. data/doc/files/ed_cpp.html +0 -101
  69. data/doc/files/em_cpp.html +0 -101
  70. data/doc/files/event_machine_rb.html +0 -118
  71. data/doc/files/g_rb.html +0 -108
  72. data/doc/files/lib/eventmachine_rb.html +0 -114
  73. data/doc/files/libmain_cpp.html +0 -101
  74. data/doc/files/sigs_cpp.html +0 -101
  75. data/doc/files/tests/testem_rb.html +0 -110
  76. data/doc/fr_class_index.html +0 -41
  77. data/doc/fr_file_index.html +0 -35
  78. data/doc/fr_method_index.html +0 -62
  79. data/doc/index.html +0 -24
  80. data/ext/libeventmachine.so +0 -0
@@ -0,0 +1,60 @@
1
+ /*****************************************************************************
2
+
3
+ $Id: sigs.cpp 2291 2006-04-14 03:56:18Z francis $
4
+
5
+ File: sigs.cpp
6
+ Date: 06Apr06
7
+
8
+ Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
9
+ Gmail: garbagecat20
10
+
11
+ This program is free software; you can redistribute it and/or modify
12
+ it under the terms of the GNU General Public License as published by
13
+ the Free Software Foundation; either version 2 of the License, or
14
+ (at your option) any later version.
15
+
16
+ This program is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU General Public License for more details.
20
+
21
+ You should have received a copy of the GNU General Public License
22
+ along with this program; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
+
25
+ *****************************************************************************/
26
+
27
+ #include "project.h"
28
+
29
+
30
+ bool gTerminateSignalReceived;
31
+
32
+
33
+ /**************
34
+ SigtermHandler
35
+ **************/
36
+
37
+ void SigtermHandler (int sig)
38
+ {
39
+ // This is a signal-handler, don't do anything frisky. Interrupts are disabled.
40
+ // Set the terminate flag WITHOUT trying to lock a mutex- otherwise we can easily
41
+ // self-deadlock, especially if the event machine is looping quickly.
42
+ gTerminateSignalReceived = true;
43
+ }
44
+
45
+
46
+ /*********************
47
+ InstallSignalHandlers
48
+ *********************/
49
+
50
+ void InstallSignalHandlers()
51
+ {
52
+ static bool bInstalled = false;
53
+ if (!bInstalled) {
54
+ bInstalled = true;
55
+ signal (SIGINT, SigtermHandler);
56
+ signal (SIGTERM, SigtermHandler);
57
+ signal (SIGPIPE, SIG_IGN);
58
+ }
59
+ }
60
+
@@ -0,0 +1,35 @@
1
+ /*****************************************************************************
2
+
3
+ $Id: sigs.h 2291 2006-04-14 03:56:18Z francis $
4
+
5
+ File: sigs.h
6
+ Date: 06Apr06
7
+
8
+ Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
9
+ Gmail: garbagecat20
10
+
11
+ This program is free software; you can redistribute it and/or modify
12
+ it under the terms of the GNU General Public License as published by
13
+ the Free Software Foundation; either version 2 of the License, or
14
+ (at your option) any later version.
15
+
16
+ This program is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU General Public License for more details.
20
+
21
+ You should have received a copy of the GNU General Public License
22
+ along with this program; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
+
25
+ *****************************************************************************/
26
+
27
+
28
+ #ifndef __Signals__H_
29
+ #define __Signals__H_
30
+
31
+ void InstallSignalHandlers();
32
+ extern bool gTerminateSignalReceived;
33
+
34
+ #endif // __Signals__H_
35
+
@@ -1,4 +1,4 @@
1
- # $Id: eventmachine.rb 2281 2006-04-13 05:09:13Z francis $
1
+ # $Id: eventmachine.rb 2289 2006-04-14 03:52:22Z francis $
2
2
  #
3
3
  # Author:: blackhedd (gmail address: garbagecat20).
4
4
  # Date:: 8 Apr 2006
@@ -9,6 +9,29 @@
9
9
  #
10
10
  # See EventMachine and EventMachine::Connection for documentation and
11
11
  # usage examples.
12
+ #
13
+ #----------------------------------------------------------------------------
14
+ #
15
+ # Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
16
+ #
17
+ # Gmail: garbagecat20
18
+ #
19
+ # This program is free software; you can redistribute it and/or modify
20
+ # it under the terms of the GNU General Public License as published by
21
+ # the Free Software Foundation; either version 2 of the License, or
22
+ # (at your option) any later version.
23
+ #
24
+ # This program is distributed in the hope that it will be useful,
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
32
+ #
33
+ #---------------------------------------------------------------------------
34
+ #
12
35
  #
13
36
 
14
37
  require 'libeventmachine'
@@ -442,6 +465,19 @@ module EventMachine
442
465
  # It's expected that a considerable amount of code will depend
443
466
  # on this behavior, so don't change it.
444
467
  #
468
+ # Ok, added support for a user-defined block, 13Apr06.
469
+ # This leads us to an interesting choice because of the
470
+ # presence of the post_init call, which happens in the
471
+ # initialize method of the new object. We call the user's
472
+ # block and pass the new object to it. This is a great
473
+ # way to do protocol-specific initiation. It happens
474
+ # AFTER post_init has been called on the object, which I
475
+ # certainly hope is the right choice.
476
+ # Don't change this lightly, because accepted connections
477
+ # are different from connected ones and we don't want
478
+ # to have them behave differently with respect to post_init
479
+ # if at all possible.
480
+ #
445
481
  def EventMachine::connect server, port, handler=nil
446
482
  s = connect_server server, port
447
483
  klass = Class.new( Connection ) {
@@ -449,6 +485,8 @@ module EventMachine
449
485
  }
450
486
  c = klass.new s
451
487
  @conns[s] = c
488
+ block_given? and yield c
489
+ c
452
490
  end
453
491
 
454
492
 
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.10
2
+ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: eventmachine
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2006-04-13
6
+ version: 0.4.0
7
+ date: 2006-04-14 00:00:00 -04:00
8
8
  summary: Ruby/EventMachine socket engine library
9
9
  require_paths:
10
10
  - lib
@@ -25,86 +25,23 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  version: 0.0.0
26
26
  version:
27
27
  platform: ruby
28
+ signing_key:
29
+ cert_chain:
28
30
  authors: []
29
31
  files:
30
32
  - tests/testem.rb
31
33
  - lib/eventmachine.rb
32
- - ext/libeventmachine.so
33
- - doc/index.html
34
- - doc/fr_method_index.html
35
- - doc/fr_file_index.html
36
- - doc/files
37
- - doc/classes
38
- - doc/fr_class_index.html
39
- - doc/created.rid
40
- - doc/files/event_machine_rb.html
41
- - doc/files/binder_cpp.html
42
- - doc/files/tests
43
- - doc/files/g_rb.html
44
- - doc/files/lib
45
- - doc/files/libmain_cpp.html
46
- - doc/files/sigs_cpp.html
47
- - doc/files/ed_cpp.html
48
- - doc/files/em_cpp.html
49
- - doc/files/tests/testem_rb.html
50
- - doc/files/lib/eventmachine_rb.html
51
- - doc/classes/Echo.html
52
- - doc/classes/Zzz.html
53
- - doc/classes/EventMachine.src
54
- - doc/classes/EventMachine
55
- - doc/classes/Zzz.src
56
- - doc/classes/EventMachine.html
57
- - doc/classes/Echo.src
58
- - doc/classes/EventMachine.src/M000008.html
59
- - doc/classes/EventMachine.src/M000009.html
60
- - doc/classes/EventMachine.src/M000005.html
61
- - doc/classes/EventMachine.src/M000006.html
62
- - doc/classes/EventMachine.src/M000002.html
63
- - doc/classes/EventMachine.src/M000003.html
64
- - doc/classes/EventMachine.src/M000007.html
65
- - doc/classes/EventMachine.src/M000010.html
66
- - doc/classes/EventMachine.src/M000011.html
67
- - doc/classes/EventMachine.src/M000004.html
68
- - doc/classes/EventMachine/TooManyAcceptors.html
69
- - doc/classes/EventMachine/NoHandlerForAcceptedConnection.html
70
- - doc/classes/EventMachine/TooManyTimersPending.html
71
- - doc/classes/EventMachine/ConnectionNotBound.html
72
- - doc/classes/EventMachine/NoServerCreated.html
73
- - doc/classes/EventMachine/Connection.html
74
- - doc/classes/EventMachine/Connections.html
75
- - doc/classes/EventMachine/NoConnectionMade.html
76
- - doc/classes/EventMachine/Connections.src
77
- - doc/classes/EventMachine/Connection.src
78
- - doc/classes/EventMachine/EventCodes.html
79
- - doc/classes/EventMachine/UnknownTimerFired.html
80
- - doc/classes/EventMachine/TimerNotInstalled.html
81
- - doc/classes/EventMachine/ConnectionAlreadyBound.html
82
- - doc/classes/EventMachine/Connections.src/M000014.html
83
- - doc/classes/EventMachine/Connections.src/M000015.html
84
- - doc/classes/EventMachine/Connections.src/M000017.html
85
- - doc/classes/EventMachine/Connections.src/M000018.html
86
- - doc/classes/EventMachine/Connections.src/M000019.html
87
- - doc/classes/EventMachine/Connections.src/M000012.html
88
- - doc/classes/EventMachine/Connections.src/M000013.html
89
- - doc/classes/EventMachine/Connections.src/M000016.html
90
- - doc/classes/EventMachine/Connection.src/M000029.html
91
- - doc/classes/EventMachine/Connection.src/M000020.html
92
- - doc/classes/EventMachine/Connection.src/M000021.html
93
- - doc/classes/EventMachine/Connection.src/M000022.html
94
- - doc/classes/EventMachine/Connection.src/M000028.html
95
- - doc/classes/EventMachine/Connection.src/M000030.html
96
- - doc/classes/EventMachine/Connection.src/M000025.html
97
- - doc/classes/EventMachine/Connection.src/M000032.html
98
- - doc/classes/EventMachine/Connection.src/M000027.html
99
- - doc/classes/EventMachine/Connection.src/M000026.html
100
- - doc/classes/EventMachine/Connection.src/M000024.html
101
- - doc/classes/EventMachine/Connection.src/M000031.html
102
- - doc/classes/EventMachine/Connection.src/M000023.html
103
- - doc/classes/Zzz.src/M000001.html
104
- - doc/classes/Echo.src/M000033.html
105
- - doc/classes/Echo.src/M000034.html
106
- - doc/classes/Echo.src/M000036.html
107
- - doc/classes/Echo.src/M000035.html
34
+ - ext/sigs.h
35
+ - ext/project.h
36
+ - ext/sigs.cpp
37
+ - ext/binder.cpp
38
+ - ext/extconf.rb
39
+ - ext/em.cpp
40
+ - ext/binder.h
41
+ - ext/ed.h
42
+ - ext/ed.cpp
43
+ - ext/em.h
44
+ - ext/libmain.cpp
108
45
  - README
109
46
  - RELEASE_NOTES
110
47
  - COPYING
@@ -116,6 +53,7 @@ extra_rdoc_files:
116
53
  - RELEASE_NOTES
117
54
  - COPYING
118
55
  executables: []
119
- extensions: []
56
+ extensions:
57
+ - ext/extconf.rb
120
58
  requirements: []
121
59
  dependencies: []
@@ -1,180 +0,0 @@
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>Module: Echo</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>Module</strong></td>
53
- <td class="class-name-in-header">Echo</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
- <a href="../files/g_rb.html">
63
- g.rb
64
- </a>
65
- <br />
66
- </td>
67
- </tr>
68
-
69
- </table>
70
- </div>
71
- <!-- banner header -->
72
-
73
- <div id="bodyContent">
74
-
75
-
76
-
77
- <div id="contextContent">
78
-
79
-
80
-
81
- </div>
82
-
83
- <div id="method-list">
84
- <h3 class="section-bar">Methods</h3>
85
-
86
- <div class="name-list">
87
- <a href="#M000034">post_init</a>&nbsp;&nbsp;
88
- <a href="#M000033">receive_data</a>&nbsp;&nbsp;
89
- <a href="#M000035">receive_data</a>&nbsp;&nbsp;
90
- <a href="#M000036">unbind</a>&nbsp;&nbsp;
91
- </div>
92
- </div>
93
-
94
- </div>
95
-
96
-
97
- <!-- if includes -->
98
-
99
- <div id="section">
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
- <!-- if method_list -->
109
- <div id="methods">
110
- <h3 class="section-bar">Public Instance methods</h3>
111
-
112
- <div id="method-M000034" class="method-detail">
113
- <a name="M000034"></a>
114
-
115
- <div class="method-heading">
116
- <a href="Echo.src/M000034.html" target="Code" class="method-signature"
117
- onclick="popupCode('Echo.src/M000034.html');return false;">
118
- <span class="method-name">post_init</span><span class="method-args">()</span>
119
- </a>
120
- </div>
121
-
122
- <div class="method-description">
123
- </div>
124
- </div>
125
-
126
- <div id="method-M000033" class="method-detail">
127
- <a name="M000033"></a>
128
-
129
- <div class="method-heading">
130
- <a href="Echo.src/M000033.html" target="Code" class="method-signature"
131
- onclick="popupCode('Echo.src/M000033.html');return false;">
132
- <span class="method-name">receive_data</span><span class="method-args">(data)</span>
133
- </a>
134
- </div>
135
-
136
- <div class="method-description">
137
- </div>
138
- </div>
139
-
140
- <div id="method-M000035" class="method-detail">
141
- <a name="M000035"></a>
142
-
143
- <div class="method-heading">
144
- <a href="Echo.src/M000035.html" target="Code" class="method-signature"
145
- onclick="popupCode('Echo.src/M000035.html');return false;">
146
- <span class="method-name">receive_data</span><span class="method-args">(data)</span>
147
- </a>
148
- </div>
149
-
150
- <div class="method-description">
151
- </div>
152
- </div>
153
-
154
- <div id="method-M000036" class="method-detail">
155
- <a name="M000036"></a>
156
-
157
- <div class="method-heading">
158
- <a href="Echo.src/M000036.html" target="Code" class="method-signature"
159
- onclick="popupCode('Echo.src/M000036.html');return false;">
160
- <span class="method-name">unbind</span><span class="method-args">()</span>
161
- </a>
162
- </div>
163
-
164
- <div class="method-description">
165
- </div>
166
- </div>
167
-
168
-
169
- </div>
170
-
171
-
172
- </div>
173
-
174
-
175
- <div id="validator-badges">
176
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
177
- </div>
178
-
179
- </body>
180
- </html>