eventmachine-with-ipv6 1.0.0.beta.4.ipv6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/.gitignore +21 -0
  2. data/.yardopts +7 -0
  3. data/FORK.md +47 -0
  4. data/GNU +281 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +60 -0
  7. data/README.md +109 -0
  8. data/Rakefile +20 -0
  9. data/docs/DocumentationGuidesIndex.md +27 -0
  10. data/docs/GettingStarted.md +521 -0
  11. data/docs/old/ChangeLog +211 -0
  12. data/docs/old/DEFERRABLES +246 -0
  13. data/docs/old/EPOLL +141 -0
  14. data/docs/old/INSTALL +13 -0
  15. data/docs/old/KEYBOARD +42 -0
  16. data/docs/old/LEGAL +25 -0
  17. data/docs/old/LIGHTWEIGHT_CONCURRENCY +130 -0
  18. data/docs/old/PURE_RUBY +75 -0
  19. data/docs/old/RELEASE_NOTES +94 -0
  20. data/docs/old/SMTP +4 -0
  21. data/docs/old/SPAWNED_PROCESSES +148 -0
  22. data/docs/old/TODO +8 -0
  23. data/eventmachine.gemspec +50 -0
  24. data/examples/guides/getting_started/01_eventmachine_echo_server.rb +18 -0
  25. data/examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb +22 -0
  26. data/examples/guides/getting_started/03_simple_chat_server.rb +149 -0
  27. data/examples/guides/getting_started/04_simple_chat_server_step_one.rb +27 -0
  28. data/examples/guides/getting_started/05_simple_chat_server_step_two.rb +43 -0
  29. data/examples/guides/getting_started/06_simple_chat_server_step_three.rb +98 -0
  30. data/examples/guides/getting_started/07_simple_chat_server_step_four.rb +121 -0
  31. data/examples/guides/getting_started/08_simple_chat_server_step_five.rb +141 -0
  32. data/examples/old/ex_channel.rb +43 -0
  33. data/examples/old/ex_queue.rb +2 -0
  34. data/examples/old/ex_tick_loop_array.rb +15 -0
  35. data/examples/old/ex_tick_loop_counter.rb +32 -0
  36. data/examples/old/helper.rb +2 -0
  37. data/ext/binder.cpp +124 -0
  38. data/ext/binder.h +46 -0
  39. data/ext/cmain.cpp +858 -0
  40. data/ext/ed.cpp +1992 -0
  41. data/ext/ed.h +423 -0
  42. data/ext/em.cpp +2358 -0
  43. data/ext/em.h +245 -0
  44. data/ext/eventmachine.h +127 -0
  45. data/ext/extconf.rb +166 -0
  46. data/ext/fastfilereader/extconf.rb +94 -0
  47. data/ext/fastfilereader/mapper.cpp +214 -0
  48. data/ext/fastfilereader/mapper.h +59 -0
  49. data/ext/fastfilereader/rubymain.cpp +127 -0
  50. data/ext/kb.cpp +79 -0
  51. data/ext/page.cpp +107 -0
  52. data/ext/page.h +51 -0
  53. data/ext/pipe.cpp +347 -0
  54. data/ext/project.h +155 -0
  55. data/ext/rubymain.cpp +1280 -0
  56. data/ext/ssl.cpp +468 -0
  57. data/ext/ssl.h +94 -0
  58. data/java/.classpath +8 -0
  59. data/java/.project +17 -0
  60. data/java/src/com/rubyeventmachine/EmReactor.java +571 -0
  61. data/java/src/com/rubyeventmachine/EmReactorException.java +40 -0
  62. data/java/src/com/rubyeventmachine/EventableChannel.java +69 -0
  63. data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -0
  64. data/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -0
  65. data/lib/em/buftok.rb +110 -0
  66. data/lib/em/callback.rb +58 -0
  67. data/lib/em/channel.rb +64 -0
  68. data/lib/em/completion.rb +304 -0
  69. data/lib/em/connection.rb +728 -0
  70. data/lib/em/deferrable.rb +210 -0
  71. data/lib/em/deferrable/pool.rb +2 -0
  72. data/lib/em/file_watch.rb +73 -0
  73. data/lib/em/future.rb +61 -0
  74. data/lib/em/iterator.rb +270 -0
  75. data/lib/em/messages.rb +66 -0
  76. data/lib/em/pool.rb +151 -0
  77. data/lib/em/process_watch.rb +45 -0
  78. data/lib/em/processes.rb +123 -0
  79. data/lib/em/protocols.rb +36 -0
  80. data/lib/em/protocols/header_and_content.rb +138 -0
  81. data/lib/em/protocols/httpclient.rb +279 -0
  82. data/lib/em/protocols/httpclient2.rb +600 -0
  83. data/lib/em/protocols/line_and_text.rb +125 -0
  84. data/lib/em/protocols/line_protocol.rb +29 -0
  85. data/lib/em/protocols/linetext2.rb +161 -0
  86. data/lib/em/protocols/memcache.rb +331 -0
  87. data/lib/em/protocols/object_protocol.rb +46 -0
  88. data/lib/em/protocols/postgres3.rb +246 -0
  89. data/lib/em/protocols/saslauth.rb +175 -0
  90. data/lib/em/protocols/smtpclient.rb +365 -0
  91. data/lib/em/protocols/smtpserver.rb +640 -0
  92. data/lib/em/protocols/socks4.rb +66 -0
  93. data/lib/em/protocols/stomp.rb +202 -0
  94. data/lib/em/protocols/tcptest.rb +54 -0
  95. data/lib/em/pure_ruby.rb +1017 -0
  96. data/lib/em/queue.rb +71 -0
  97. data/lib/em/resolver.rb +195 -0
  98. data/lib/em/spawnable.rb +84 -0
  99. data/lib/em/streamer.rb +118 -0
  100. data/lib/em/threaded_resource.rb +90 -0
  101. data/lib/em/tick_loop.rb +85 -0
  102. data/lib/em/timers.rb +61 -0
  103. data/lib/em/version.rb +3 -0
  104. data/lib/eventmachine.rb +1517 -0
  105. data/lib/jeventmachine.rb +279 -0
  106. data/rakelib/cpp.rake_example +77 -0
  107. data/rakelib/package.rake +98 -0
  108. data/rakelib/test.rake +8 -0
  109. data/tests/client.crt +31 -0
  110. data/tests/client.key +51 -0
  111. data/tests/em_test_helper.rb +64 -0
  112. data/tests/test_attach.rb +126 -0
  113. data/tests/test_basic.rb +294 -0
  114. data/tests/test_channel.rb +62 -0
  115. data/tests/test_completion.rb +177 -0
  116. data/tests/test_connection_count.rb +33 -0
  117. data/tests/test_defer.rb +18 -0
  118. data/tests/test_deferrable.rb +35 -0
  119. data/tests/test_epoll.rb +134 -0
  120. data/tests/test_error_handler.rb +38 -0
  121. data/tests/test_exc.rb +28 -0
  122. data/tests/test_file_watch.rb +65 -0
  123. data/tests/test_futures.rb +170 -0
  124. data/tests/test_get_sock_opt.rb +37 -0
  125. data/tests/test_handler_check.rb +35 -0
  126. data/tests/test_hc.rb +155 -0
  127. data/tests/test_httpclient.rb +190 -0
  128. data/tests/test_httpclient2.rb +128 -0
  129. data/tests/test_inactivity_timeout.rb +54 -0
  130. data/tests/test_ipv4.rb +128 -0
  131. data/tests/test_ipv6.rb +135 -0
  132. data/tests/test_kb.rb +34 -0
  133. data/tests/test_ltp.rb +138 -0
  134. data/tests/test_ltp2.rb +288 -0
  135. data/tests/test_next_tick.rb +104 -0
  136. data/tests/test_object_protocol.rb +36 -0
  137. data/tests/test_pause.rb +78 -0
  138. data/tests/test_pending_connect_timeout.rb +52 -0
  139. data/tests/test_pool.rb +194 -0
  140. data/tests/test_process_watch.rb +48 -0
  141. data/tests/test_processes.rb +133 -0
  142. data/tests/test_proxy_connection.rb +168 -0
  143. data/tests/test_pure.rb +88 -0
  144. data/tests/test_queue.rb +50 -0
  145. data/tests/test_resolver.rb +55 -0
  146. data/tests/test_running.rb +14 -0
  147. data/tests/test_sasl.rb +47 -0
  148. data/tests/test_send_file.rb +217 -0
  149. data/tests/test_servers.rb +33 -0
  150. data/tests/test_set_sock_opt.rb +41 -0
  151. data/tests/test_shutdown_hooks.rb +23 -0
  152. data/tests/test_smtpclient.rb +55 -0
  153. data/tests/test_smtpserver.rb +57 -0
  154. data/tests/test_spawn.rb +293 -0
  155. data/tests/test_ssl_args.rb +78 -0
  156. data/tests/test_ssl_methods.rb +48 -0
  157. data/tests/test_ssl_verify.rb +82 -0
  158. data/tests/test_threaded_resource.rb +53 -0
  159. data/tests/test_tick_loop.rb +59 -0
  160. data/tests/test_timers.rb +123 -0
  161. data/tests/test_ud.rb +8 -0
  162. data/tests/test_udp46.rb +54 -0
  163. data/tests/test_unbind_reason.rb +48 -0
  164. metadata +319 -0
@@ -0,0 +1,141 @@
1
+ EventMachine now supports epoll, bringing large increases in performance and scalability to Ruby programs.
2
+
3
+ Epoll(7) is a alternative mechanism for multiplexed I/O that is available in Linux 2.6 kernels.
4
+ It features significantly greater performance than the standard select(2) mechanism, when used in
5
+ applications that require very large numbers of open I/O descriptors.
6
+
7
+ EventMachine has always used select(2) because its behavior is well standardized and broadly supported.
8
+ But select becomes unreasonably slow when a program has a
9
+ very large number of file descriptors or sockets. Ruby's version of select hardcodes a limit
10
+ of 1024 descriptors per process, but heavily loaded processes will start to show performance
11
+ degradation even after only a few hundred descriptors are in use.
12
+
13
+ Epoll is an extended version of the poll(2) call, and it solves the problems with select. Programs
14
+ based on epoll can easily scale past Ruby's 1024-descriptor limit, potentially to tens of thousands
15
+ of connectors, with no significant impact on performance.
16
+
17
+ (Another alternative which is very similar to epoll in principle is kqueue, supplied on BSD and its
18
+ variants.)
19
+
20
+
21
+
22
+ This note shows you how to use epoll in your programs.
23
+
24
+ === Compiling EventMachine to use epoll.
25
+
26
+ You don't have to do anything to get epoll support in EventMachine.
27
+ When you compile EventMachine on a platform that supports epoll, EM will
28
+ automatically generate a Makefile that includes epoll. (At this writing, this will only work
29
+ on Linux 2.6 kernels.) If you compile EM on a platform without epoll, then epoll support will
30
+ be omitted from the Makefile, and EM will work just as it always has.
31
+
32
+ === Using epoll in your programs.
33
+
34
+ First, you need to tell EventMachine to use epoll instead of select (but see below, as this requirement
35
+ will be removed in a future EventMachine version). Second, you need to prepare your program to use
36
+ more than 1024 descriptors, an operation that generally requires superuser privileges. Third, you will probably
37
+ want your process to drop the superuser privileges after you increase your process's descriptor limit.
38
+
39
+ === Using EventMachine#epoll
40
+
41
+ Call the method EventMachine#epoll anytime before you call EventMachine#run, and your program will
42
+ automatically use epoll, if available. It's safe to call EventMachine#epoll on any platform because
43
+ it compiles to a no-op on platforms that don't support epoll.
44
+
45
+ require 'rubygems'
46
+ require 'eventmachine'
47
+
48
+ EM.epoll
49
+ EM.run {
50
+ ...
51
+ }
52
+
53
+
54
+ EventMachine#epoll was included in this initial release only to avoid changing the behavior of existing
55
+ programs. However, it's expected that a future release of EM will convert EventMachine#epoll to a no-op,
56
+ and run epoll by default on platforms that support it.
57
+
58
+ === Using EventMachine#set_descriptor_table_size
59
+
60
+ In Linux (as in every Unix-like platform), every process has a internal table that determines the maximum
61
+ number of file and socket descriptors you may have open at any given time. The size of this table is
62
+ generally fixed at 1024, although it may be increased within certain system-defined hard and soft limits.
63
+
64
+ If you want your EventMachine program to support more than 1024 total descriptors, you must use
65
+ EventMachine#set_descriptor_table_size, as follows:
66
+
67
+ require 'rubygems'
68
+ require 'eventmachine'
69
+
70
+ new_size = EM.set_descriptor_table_size( 60000 )
71
+ $>.puts "New descriptor-table size is #{new_size}"
72
+
73
+ EM.run {
74
+ ...
75
+ }
76
+
77
+ If successful, this example will increase the maximum number of descriptors that epoll can use to 60,000.
78
+ Call EventMachine#set_descriptor_table_size without an argument at any time to find out the current
79
+ size of the descriptor table.
80
+
81
+ Using EventMachine#set_descriptor_table_size ONLY affects the number of descriptors that can be used
82
+ by epoll. It has no useful effect on platforms that don't support epoll, and it does NOT increase the
83
+ number of descriptors that Ruby's own I/O functions can use.
84
+
85
+ #set_descriptor_table_size can fail if your process is not running as superuser, or if you try to set a
86
+ table size that exceeds the hard limits imposed by your system. In the latter case, try a smaller number.
87
+
88
+
89
+ === Using EventMachine#set_effective_user
90
+
91
+ In general, you must run your program with elevated or superuser privileges if you want to increase
92
+ your descriptor-table size beyond 1024 descriptors. This is easy enough to verify. Try running the
93
+ sample program given above, that increases the descriptor limit to 60,000. You will probably find that
94
+ the table size will not be increased if you don't run your program as root or with elevated privileges.
95
+
96
+ But of course network servers, especially long-running ones, should not run with elevated privileges.
97
+ You will want to drop superuser privileges as soon as possible after initialization. To do this,
98
+ use EventMachine#set_effective_user:
99
+
100
+ require 'rubygems'
101
+ require 'eventmachine'
102
+
103
+ # (Here, program is running as superuser)
104
+
105
+ EM.set_descriptor_table_size( 60000 )
106
+ EM.set_effective_user( "nobody" )
107
+ # (Here, program is running as nobody)
108
+
109
+ EM.run {
110
+ ...
111
+ }
112
+
113
+ Of course, you will need to replace "nobody" in the example with the name of an unprivileged user
114
+ that is valid on your system. What if you want to drop privileges after opening a server socket
115
+ on a privileged (low-numbered) port? Easy, just call #set_effective_user after opening your sockets:
116
+
117
+ require 'rubygems'
118
+ require 'eventmachine'
119
+
120
+ # (Here, program is running as superuser)
121
+
122
+ EM.set_descriptor_table_size( 60000 )
123
+
124
+ EM.run {
125
+ EM.start_server( "0.0.0.0", 80, MyHttpServer )
126
+ EM.start_server( "0.0.0.0", 443, MyEncryptedHttpServer )
127
+
128
+ EM.set_effective_user( "nobody" )
129
+ # (Here, program is running as nobody)
130
+
131
+ ...
132
+ }
133
+
134
+
135
+ Because EventMachine#set_effective_user is used to enforce security
136
+ requirements, it has no nonfatal errors. If you try to set a nonexistent or invalid effective user,
137
+ #set_effective_user will abort your program, rather than continue to run with elevated privileges.
138
+
139
+ EventMachine#set_effective_user is a silent no-op on platforms that don't support it, such as Windows.
140
+
141
+
@@ -0,0 +1,13 @@
1
+ If you have obtained an EventMachine source-tarball (.tar.gz):
2
+ unzip and untar the tarball, and enter the directory that is
3
+ created. In that directory, say:
4
+ ruby setup.rb
5
+ (You may need to be root to execute this command.)
6
+
7
+ To create documentation for EventMachine, simply type:
8
+ rake rdoc
9
+ in the distro directory. Rdocs will be created in subdirectory rdoc.
10
+
11
+ If you have obtained a gem version of EventMachine, install it in the
12
+ usual way (gem install eventmachine). You may need superuser privileges
13
+ to execute this command.
@@ -0,0 +1,42 @@
1
+ EventMachine (EM) can respond to keyboard events. This gives your event-driven
2
+ programs the ability to respond to input from local users.
3
+
4
+ Programming EM to handle keyboard input in Ruby is simplicity itself. Just use
5
+ EventMachine#open_keyboard, and supply the name of a Ruby module or class that
6
+ will receive the input:
7
+
8
+ require 'rubygems'
9
+ require 'eventmachine'
10
+
11
+ module MyKeyboardHandler
12
+ def receive_data keystrokes
13
+ puts "I received the following data from the keyboard: #{keystrokes}"
14
+ end
15
+ end
16
+
17
+ EM.run {
18
+ EM.open_keyboard(MyKeyboardHandler)
19
+ }
20
+
21
+ If you want EM to send line-buffered keyboard input to your program, just
22
+ include the LineText2 protocol module in your handler class or module:
23
+
24
+ require 'rubygems'
25
+ require 'eventmachine'
26
+
27
+ module MyKeyboardHandler
28
+ include EM::Protocols::LineText2
29
+ def receive_line data
30
+ puts "I received the following line from the keyboard: #{data}"
31
+ end
32
+ end
33
+
34
+ EM.run {
35
+ EM.open_keyboard(MyKeyboardHandler)
36
+ }
37
+
38
+ As we said, simplicity itself. You can call EventMachine#open_keyboard at any
39
+ time while the EM reactor loop is running. In other words, the method
40
+ invocation may appear anywhere in an EventMachine#run block, or in any code
41
+ invoked in the #run block.
42
+
@@ -0,0 +1,25 @@
1
+ LEGAL NOTICE INFORMATION
2
+ ------------------------
3
+
4
+ EventMachine is Copyright (C) 2006-07 by Francis Cianfrocca.
5
+
6
+ EventMachine is copyrighted software owned by Francis Cianfrocca
7
+ (blackhedd ... gmail.com). You may redistribute and/or modify this
8
+ software as long as you comply with either the terms of the GPL
9
+ (see the file GPL), or Ruby's license (see the file COPYING).
10
+
11
+ Your use of all the files in this distribution is controlled by these
12
+ license terms, except for those files specifically mentioned below:
13
+
14
+
15
+
16
+ setup.rb
17
+ This file is Copyright (C) 2000-2005 by Minero Aoki
18
+ You can distribute/modify this file under the terms of
19
+ the GNU LGPL, Lesser General Public License version 2.1.
20
+
21
+
22
+ lib/em/buftok.rb
23
+ This file is Copyright (C) 2007 by Tony Arcieri. This file is
24
+ covered by the terms of Ruby's License (see the file COPYING).
25
+
@@ -0,0 +1,130 @@
1
+ EventMachine (EM) adds two different formalisms for lightweight concurrency to
2
+ the Ruby programmer's toolbox: spawned processes and deferrables. This note
3
+ will show you how to use them.
4
+
5
+
6
+ === What is Lightweight Concurrency?
7
+
8
+ We use the term "Lightweight Concurrency" (LC) to refer to concurrency
9
+ mechanisms that are lighter than Ruby threads. By "lighter," we mean: less
10
+ resource-intensive in one or more dimensions, usually including memory and
11
+ CPU usage. In general, you turn to LC in the hope of improving the
12
+ performance and scalability of your programs.
13
+
14
+ In addition to the two EventMachine mechanisms we will discuss here, Ruby
15
+ has at least one other LC construct: Fibers, which are currently under
16
+ development in Ruby 1.9.
17
+
18
+ The technical feature that makes all of these LC mechanisms different from
19
+ standard Ruby threads is that they are not scheduled automatically.
20
+
21
+ When you create and run Ruby threads, you can assume (within certain
22
+ constraints) that your threads will all be scheduled fairly by Ruby's runtime.
23
+ Ruby itself is responsible for giving each of your threads its own share of
24
+ the total runtime.
25
+
26
+ But with LC, your program is responsible for causing different execution
27
+ paths to run. In effect, your program has to act as a "thread scheduler."
28
+ Scheduled entities in LC run to completion and are never preempted. The
29
+ runtime system has far less work to do since it has no need to interrupt
30
+ threads or to schedule them fairly. This is what makes LC lighter and faster.
31
+
32
+ You'll learn exactly how LC scheduling works in practice as we work through
33
+ specific examples.
34
+
35
+
36
+ === EventMachine Lightweight Concurrency
37
+
38
+ Recall that EM provides a reactor loop that must be running in order for
39
+ your programs to perform event-driven logic. An EM program typically has a
40
+ structure like this:
41
+
42
+ require 'eventmachine'
43
+
44
+ # your initializations
45
+
46
+ EM.run {
47
+ # perform event-driven I/O here, including network clients,
48
+ # servers, timers, and thread-pool operations.
49
+ }
50
+
51
+ # your cleanup
52
+ # end of the program
53
+
54
+
55
+ EventMachine#run executes the reactor loop, which causes your code to be
56
+ called as events of interest to your program occur. The block you pass to
57
+ EventMachine#run is executed right after the reactor loop starts, and is
58
+ the right place to start socket acceptors, etc.
59
+
60
+ Because the reactor loop runs constantly in an EM program (until it is
61
+ stopped by a call to EventMachine#stop), it has the ability to schedule
62
+ blocks of code for asynchronous execution. Unlike a pre-emptive thread
63
+ scheduler, it's NOT able to interrupt code blocks while they execute. But
64
+ the scheduling capability it does have is enough to enable lightweight
65
+ concurrency.
66
+
67
+
68
+ For information on Spawned Processes, see the separate document
69
+ SPAWNED_PROCESSES.
70
+
71
+ For information on Deferrables, see the separate document DEFERRABLES.
72
+
73
+
74
+ === [SIDEBAR]: I Heard That EventMachine Doesn't Work With Ruby Threads.
75
+
76
+ This is incorrect. EM is fully interoperable with all versions of Ruby
77
+ threads, and has been since its earliest releases.
78
+
79
+ It's very true that EM encourages an "evented" (non-threaded) programming
80
+ style. The specific benefits of event-driven programming are far better
81
+ performance and scalability for well-written programs, and far easier
82
+ debugging.
83
+
84
+ The benefit of using threads for similar applications is a possibly more
85
+ intuitive programming model, as well as the fact that threads are already
86
+ familiar to most programmers. Also, bugs in threaded programs often fail
87
+ to show up until programs go into production. These factors create the
88
+ illusion that threaded programs are easier to write.
89
+
90
+ However, some operations that occur frequently in professional-caliber
91
+ applications simply can't be done without threads. (The classic example
92
+ is making calls to database client-libraries that block on network I/O
93
+ until they complete.)
94
+
95
+ EventMachine not only allows the use of Ruby threads in these cases, but
96
+ it even provides a built-in thread-pool object to make them easier to
97
+ work with.
98
+
99
+ You may have heard a persistent criticism that evented I/O is fundamentally
100
+ incompatible with Ruby threads. It is true that some well-publicized attempts
101
+ to incorporate event-handling libraries into Ruby were not successful. But
102
+ EventMachine was designed from the ground up with Ruby compatibility in mind,
103
+ so EM never suffered from the problems that defeated the earlier attempts.
104
+
105
+
106
+ === [SIDEBAR]: I Heard That EventMachine Doesn't Work Very Well On Windows.
107
+
108
+ This too is incorrect. EventMachine is an extension written in C++ and Java,
109
+ and therefore it requires compilation. Many Windows computers (and some Unix
110
+ computers, especially in production environments) don't have a build stack.
111
+ Attempting to install EventMachine on a machine without a compiler usually
112
+ produces a confusing error.
113
+
114
+ In addition, Ruby has a much-debated issue with Windows compiler versions.
115
+ Ruby on Windows works best with Visual Studio 6, a compiler version that is
116
+ long out-of-print, no longer supported by Microsoft, and difficult to obtain.
117
+ (This problem is not specific to EventMachine.)
118
+
119
+ Shortly after EventMachine was first released, the compiler issues led to
120
+ criticism that EM was incompatible with Windows. Since that time, every
121
+ EventMachine release has been supplied in a precompiled binary form for
122
+ Windows users, that does not require you to compile the code yourself. EM
123
+ binary Gems for Windows are compiled using Visual Studio 6.
124
+
125
+ EventMachine does supply some advanced features (such as Linux EPOLL support,
126
+ reduced-privilege operation, UNIX-domain sockets, etc.) that have no
127
+ meaningful implementation on Windows. Apart from these special cases, all EM
128
+ functionality (including lightweight concurrency) works perfectly well on
129
+ Windows.
130
+
@@ -0,0 +1,75 @@
1
+ EventMachine is supplied in three alternative versions.
2
+
3
+ 1) A version that includes a Ruby extension written in C++. This version requires compilation;
4
+ 2) A version for JRuby that contains a precompiled JAR file written in Java;
5
+ 3) A pure Ruby version that has no external dependencies and can run in any Ruby environment.
6
+
7
+ The Java version of EventMachine is packaged in a distinct manner and must be installed using a
8
+ special procedure. This version is described fully in a different document, and not considered
9
+ further here.
10
+
11
+ The C++ and pure-Ruby versions, however, are shipped in the same distribution. You use the same
12
+ files (either tarball or Ruby gem) to install both of these versions.
13
+
14
+ If you intend to use the C++ version, you must successfully compile EventMachine after you install it.
15
+ (The gem installation attempts to perform this step automatically.)
16
+
17
+ If you choose not to compile the EventMachine C++ extension, or if your compilation fails for any
18
+ reason, you still have a fully-functional installation of the pure-Ruby version of EM.
19
+
20
+ However, for technical reasons, a default EM installation (whether or not the compilation succeeds)
21
+ will always assume that the compiled ("extension") implementation should be used.
22
+
23
+ If you want your EM program to use the pure Ruby version, you must specifically request it. There
24
+ are two ways to do this: by setting either a Ruby global variable, or an environment string.
25
+
26
+ The following code will invoke the pure-Ruby implementation of EM:
27
+
28
+ $eventmachine_library = :pure_ruby
29
+ require 'eventmachine'
30
+
31
+ EM.library_type #=> "pure_ruby"
32
+
33
+ Notice that this requires a code change and is not the preferred way to select pure Ruby, unless
34
+ for some reason you are absolutely sure you will never want the compiled implementation.
35
+
36
+ Setting the following environment string has the same effect:
37
+
38
+ export EVENTMACHINE_LIBRARY="pure_ruby"
39
+
40
+ This technique gives you the flexibility to select either version at runtime with no code changes.
41
+
42
+ Support
43
+
44
+ The EventMachine development team has committed to support precisely the same APIs for all the
45
+ various implementations of EM.
46
+
47
+ This means that you can expect any EM program to behave identically, whether you use pure Ruby,
48
+ the compiled C++ extension, or JRuby. Deviations from this behavior are to be considered bugs
49
+ and should be reported as such.
50
+
51
+ There is a small number of exceptions to this rule, which arise from underlying platform
52
+ distinctions. Notably, EM#epoll is a silent no-op in the pure Ruby implementation.
53
+
54
+
55
+ When Should You Use the Pure-Ruby Implementation of EM?
56
+
57
+
58
+ Use the pure Ruby implementation of EM when you must support a platform for which no C++ compiler
59
+ is available, or on which the standard EM C++ code can't be compiled.
60
+
61
+ Keep in mind that you don't need a C++ compiler in order to deploy EM applications that rely on
62
+ the compiled version, so long as appropriate C++ runtime libraries are available on the target platform.
63
+
64
+ In extreme cases, you may find that you can develop software with the compiled EM version, but are
65
+ not allowed to install required runtime libraries on the deployment system(s). This would be another
66
+ case in which the pure Ruby implementation can be useful.
67
+
68
+ In general you should avoid the pure Ruby version of EM when performance and scalability are important.
69
+ EM in pure Ruby will necessarily run slower than the compiled version. Depending on your application
70
+ this may or may not be a key issue.
71
+
72
+ Also, since EPOLL is not supported in pure Ruby, your applications will be affected by Ruby's built-in
73
+ limit of 1024 file and socket descriptors that may be open in a single process. For maximum scalability
74
+ and performance, always use EPOLL if possible.
75
+
@@ -0,0 +1,94 @@
1
+ RUBY/EventMachine RELEASE NOTES
2
+
3
+ --------------------------------------------------
4
+ Version: 0.9.0, released xxXXX07
5
+ Added Erlang-like distributed-computing features
6
+
7
+ --------------------------------------------------
8
+ Version: 0.8.0, released 23Jun07
9
+ Added an epoll implementation for Linux 2.6 kernels.
10
+ Added evented #popen.
11
+
12
+ --------------------------------------------------
13
+ Version: 0.7.3, released 22May07
14
+ Added a large variety of small features. See the ChangeLog.
15
+
16
+ --------------------------------------------------
17
+ Version: 0.7.1, released xxNov06
18
+ Added protocol handlers for line-oriented protocols.
19
+ Various bug fixes.
20
+
21
+ --------------------------------------------------
22
+ Version: 0.7.0, released 20Nov06
23
+ Added a fix in em.cpp/ConnectToServer to fix a fatal exception that
24
+ occurred in FreeBSD when connecting successfully to a remote server.
25
+
26
+ --------------------------------------------------
27
+ Version: 0.6.0, released xxJul06
28
+ Added deferred operations, suggested by Don Stocks, amillionhitpoints@yahoo.com.
29
+
30
+ --------------------------------------------------
31
+ Version: 0.5.4, released xxJun06
32
+ Added get_peername support for streams and datagrams.
33
+
34
+ --------------------------------------------------
35
+ Version: 0.5.3, released 17May06
36
+ Fixed bugs in extconf.rb, thanks to Daniel Harple, dharple@generalconsumption.org.
37
+ Added proper setup.rb and rake tasks, thanks to Austin Ziegler.
38
+ Fixed a handful of reported problems with builds on various platforms.
39
+
40
+ --------------------------------------------------
41
+ Version: 0.5.2, released 05May06
42
+ Made several nonvisible improvements to the Windows
43
+ implementation.
44
+ Added an exception-handling patch contributed by Jeff Rose, jeff@rosejn.net.
45
+ Added a dir-config patch contributed anonymously.
46
+ Supported builds on Solaris.
47
+
48
+ --------------------------------------------------
49
+ Version: 0.5.1, released 05May06
50
+ Made it possible to pass a Class rather than a Module
51
+ to a protocol handler.
52
+ Added Windows port.
53
+
54
+ --------------------------------------------------
55
+ Version: 0.5.0, released 30Apr06
56
+ Added a preliminary SSL/TLS extension. This will probably
57
+ change over the next few releases.
58
+
59
+ --------------------------------------------------
60
+ Version: 0.4.5, released 29Apr06
61
+ Changed ext files so the ruby.h is installed after unistd.h
62
+ otherwise it doesn't compile on gcc 4.1
63
+
64
+ --------------------------------------------------
65
+ Version: 0.4.2, released 19Apr06
66
+ Changed the Ruby-glue so the extension will play nicer
67
+ in the sandbox with Ruby threads.
68
+ Added an EventMachine::run_without_threads API to
69
+ switch off the thread-awareness for better performance
70
+ in programs that do not spin any Ruby threads.
71
+
72
+ --------------------------------------------------
73
+ Version: 0.4.1, released 15Apr06
74
+ Reworked the shared-object interface to make it easier to
75
+ use EventMachine from languages other than Ruby.
76
+
77
+ --------------------------------------------------
78
+ Version: 0.3.2, released 12Apr06
79
+ Added support for a user-supplied block in EventMachine#connect.
80
+
81
+ --------------------------------------------------
82
+ Version: 0.3.1, released 11Apr06
83
+ Fixed bug that prevented EventMachine from being run multiple
84
+ times in a single process.
85
+
86
+ --------------------------------------------------
87
+ Version: 0.3.0, released 10Apr06
88
+ Added method EventHandler::Connection::post_init
89
+
90
+ --------------------------------------------------
91
+ Version: 0.2.0, released 10Apr06
92
+ Added method EventHandler::stop
93
+
94
+