Permalink
Browse files

Merge branch 'master' into close_schedule_fix

* master: (146 commits)
  Fix reconnect on unix-domain connection #261
  Fix rake-compiler cross compiling issues for win32 gems
  Another compile warning
  Fix compile warning
  README grammar fix
  bump rake-compiler dependency
  Remove dependency on readbytes.rb for ruby 1.9 (fixes #167, #234)
  Fix compilation on MSVC2008 (fixes #253)
  fix code samples in iterator docs
  pull pause/resume logic down into EventableDescriptor
  test EM::Connection#pause on popen connections
  print out ssl errors to stdout before exploding
  Renaming EventMachine_t Closing to Deregister
  Watched sockets should still receive Closing
  Tweaking the patch to only affect socket shutdown and close. Ref: #242
  Alias Ruby C API methods for 1.8/1.9 compat
  Add pure-ruby implementations of EM::Connection#set_sock_opt and #get_sock_opt
  Implement EM::Connection#set_sock_opt
  Never close STDIN, STDOUT and STDERR (i.e. only close when fd > 2) Should solve #183
  Segfault fix for pipes
  ...

Conflicts:
	ext/em.cpp
	tests/test_basic.rb
  • Loading branch information...
2 parents df0d643 + 4d4de9d commit 2cd0c19276edde3fb4c0af699fa8caa6b1f3923a @raggi raggi committed Sep 29, 2011
Showing with 5,966 additions and 8,071 deletions.
  1. +5 −0 .gitignore
  2. +7 −0 .yardopts
  3. 0 {docs → }/GNU
  4. +3 −0 Gemfile
  5. 0 docs/COPYING → LICENSE
  6. +0 −81 README
  7. +109 −0 README.md
  8. +13 −369 Rakefile
  9. +27 −0 docs/DocumentationGuidesIndex.md
  10. +521 −0 docs/GettingStarted.md
  11. 0 docs/{ → old}/ChangeLog
  12. 0 docs/{ → old}/DEFERRABLES
  13. 0 docs/{ → old}/EPOLL
  14. 0 docs/{ → old}/INSTALL
  15. 0 docs/{ → old}/KEYBOARD
  16. 0 docs/{ → old}/LEGAL
  17. 0 docs/{ → old}/LIGHTWEIGHT_CONCURRENCY
  18. 0 docs/{ → old}/PURE_RUBY
  19. 0 docs/{ → old}/RELEASE_NOTES
  20. 0 docs/{ → old}/SMTP
  21. 0 docs/{ → old}/SPAWNED_PROCESSES
  22. 0 docs/{ → old}/TODO
  23. +20 −26 eventmachine.gemspec
  24. +18 −0 examples/guides/getting_started/01_eventmachine_echo_server.rb
  25. +22 −0 examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb
  26. +149 −0 examples/guides/getting_started/03_simple_chat_server.rb
  27. +27 −0 examples/guides/getting_started/04_simple_chat_server_step_one.rb
  28. +43 −0 examples/guides/getting_started/05_simple_chat_server_step_two.rb
  29. +98 −0 examples/guides/getting_started/06_simple_chat_server_step_three.rb
  30. +121 −0 examples/guides/getting_started/07_simple_chat_server_step_four.rb
  31. +141 −0 examples/guides/getting_started/08_simple_chat_server_step_five.rb
  32. +3 −3 examples/{ → old}/ex_channel.rb
  33. 0 examples/{ → old}/ex_queue.rb
  34. 0 examples/{ → old}/ex_tick_loop_array.rb
  35. 0 examples/{ → old}/ex_tick_loop_counter.rb
  36. 0 examples/{ → old}/helper.rb
  37. +11 −24 ext/cmain.cpp
  38. +0 −202 ext/cplusplus.cpp
  39. +142 −51 ext/ed.cpp
  40. +17 −16 ext/ed.h
  41. +114 −145 ext/em.cpp
  42. +15 −16 ext/em.h
  43. +0 −300 ext/emwin.cpp
  44. +0 −94 ext/emwin.h
  45. +0 −26 ext/epoll.cpp
  46. +0 −25 ext/epoll.h
  47. +5 −5 ext/eventmachine.h
  48. +0 −96 ext/eventmachine_cpp.h
  49. +53 −46 ext/extconf.rb
  50. +1 −1 ext/fastfilereader/extconf.rb
  51. +0 −94 ext/files.cpp
  52. +0 −65 ext/files.h
  53. +11 −11 ext/pipe.cpp
  54. +3 −5 ext/project.h
  55. +80 −32 ext/rubymain.cpp
  56. +0 −89 ext/sigs.cpp
  57. +0 −32 ext/sigs.h
  58. +5 −0 ext/ssl.cpp
  59. +3 −2 java/src/com/rubyeventmachine/EmReactor.java
  60. +0 −194 java/src/com/rubyeventmachine/application/Application.java
  61. +0 −74 java/src/com/rubyeventmachine/application/Connection.java
  62. +0 −37 java/src/com/rubyeventmachine/application/ConnectionFactory.java
  63. +0 −46 java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java
  64. +0 −38 java/src/com/rubyeventmachine/application/PeriodicTimer.java
  65. +0 −54 java/src/com/rubyeventmachine/application/Timer.java
  66. +0 −109 java/src/com/rubyeventmachine/tests/ApplicationTest.java
  67. +0 −148 java/src/com/rubyeventmachine/tests/ConnectTest.java
  68. +0 −80 java/src/com/rubyeventmachine/tests/EMTest.java
  69. +0 −53 java/src/com/rubyeventmachine/tests/TestDatagrams.java
  70. +0 −75 java/src/com/rubyeventmachine/tests/TestServers.java
  71. +0 −90 java/src/com/rubyeventmachine/tests/TestTimers.java
  72. +35 −63 lib/em/buftok.rb
  73. +43 −11 lib/em/callback.rb
  74. +22 −15 lib/em/channel.rb
  75. +304 −0 lib/em/completion.rb
  76. +346 −209 lib/em/connection.rb
  77. +20 −2 lib/em/deferrable.rb
  78. +2 −0 lib/em/deferrable/pool.rb
  79. +37 −18 lib/em/file_watch.rb
  80. +46 −43 lib/em/iterator.rb
  81. +146 −0 lib/em/pool.rb
  82. +5 −4 lib/em/process_watch.rb
  83. +8 −4 lib/em/processes.rb
  84. +1 −1 lib/em/protocols.rb
  85. +27 −11 lib/em/protocols/httpclient.rb
  86. +15 −5 lib/em/protocols/httpclient2.rb
  87. +29 −0 lib/em/protocols/line_protocol.rb
  88. +17 −9 lib/em/protocols/memcache.rb
  89. +2 −1 lib/em/protocols/object_protocol.rb
  90. +8 −9 lib/em/protocols/postgres3.rb
  91. +19 −11 lib/em/protocols/smtpclient.rb
  92. +21 −8 lib/em/protocols/smtpserver.rb
  93. +9 −7 lib/em/protocols/stomp.rb
  94. +3 −2 lib/em/protocols/tcptest.rb
  95. +200 −205 lib/{pr_eventmachine.rb → em/pure_ruby.rb}
  96. +23 −13 lib/em/queue.rb
  97. +192 −0 lib/em/resolver.rb
  98. +9 −10 lib/em/spawnable.rb
  99. +34 −46 lib/em/streamer.rb
  100. +90 −0 lib/em/threaded_resource.rb
  101. +8 −3 lib/em/timers.rb
  102. +1 −1 lib/em/version.rb
  103. +569 −680 lib/eventmachine.rb
  104. +0 −32 lib/evma.rb
  105. +0 −32 lib/evma/callback.rb
  106. +0 −75 lib/evma/container.rb
  107. +0 −77 lib/evma/factory.rb
  108. +0 −87 lib/evma/protocol.rb
  109. +0 −48 lib/evma/reactor.rb
  110. +25 −3 lib/jeventmachine.rb
  111. +0 −1,585 setup.rb
  112. +98 −0 tasks/package.rake
  113. +8 −0 tasks/test.rake
  114. +64 −0 tests/em_test_helper.rb
  115. +46 −56 tests/test_attach.rb
  116. +74 −125 tests/test_basic.rb
  117. +5 −6 tests/test_channel.rb
  118. +177 −0 tests/test_completion.rb
  119. +1 −3 tests/test_connection_count.rb
  120. +3 −32 tests/test_defer.rb
  121. +35 −0 tests/test_deferrable.rb
  122. +27 −57 tests/test_epoll.rb
  123. +10 −7 tests/test_error_handler.rb
  124. +0 −82 tests/test_errors.rb
  125. +6 −33 tests/test_exc.rb
  126. +51 −35 tests/test_file_watch.rb
  127. +9 −37 tests/test_futures.rb
  128. +27 −20 tests/test_get_sock_opt.rb
  129. +1 −3 tests/test_handler_check.rb
  130. +24 −59 tests/test_hc.rb
  131. +31 −68 tests/test_httpclient.rb
  132. +12 −38 tests/test_httpclient2.rb
  133. +44 −40 tests/test_inactivity_timeout.rb
  134. +26 −52 tests/test_kb.rb
  135. +23 −75 tests/test_ltp.rb
  136. +1 −30 tests/test_ltp2.rb
  137. +1 −30 tests/test_next_tick.rb
  138. +8 −9 tests/test_object_protocol.rb
  139. +45 −37 tests/test_pause.rb
  140. +42 −38 tests/test_pending_connect_timeout.rb
  141. +128 −0 tests/test_pool.rb
  142. +37 −37 tests/test_process_watch.rb
  143. +110 −110 tests/test_processes.rb
  144. +137 −61 tests/test_proxy_connection.rb
  145. +29 −75 tests/test_pure.rb
  146. +10 −4 tests/test_queue.rb
  147. +55 −0 tests/test_resolver.rb
  148. +1 −29 tests/test_running.rb
  149. +7 −32 tests/test_sasl.rb
  150. +162 −196 tests/test_send_file.rb
  151. +13 −56 tests/test_servers.rb
  152. +37 −0 tests/test_set_sock_opt.rb
  153. +23 −0 tests/test_shutdown_hooks.rb
  154. +1 −29 tests/test_smtpclient.rb
  155. +1 −29 tests/test_smtpserver.rb
  156. +2 −31 tests/test_spawn.rb
  157. +9 −10 tests/test_ssl_args.rb
  158. +1 −3 tests/test_ssl_methods.rb
  159. +63 −63 tests/test_ssl_verify.rb
  160. +53 −0 tests/test_threaded_resource.rb
  161. +1 −1 tests/test_tick_loop.rb
  162. +52 −89 tests/test_timers.rb
  163. +1 −29 tests/test_ud.rb
  164. +31 −0 tests/test_unbind_reason.rb
  165. +0 −31 tests/testem.rb
View
@@ -14,3 +14,8 @@ Makefile
*.dSYM
java/src/.project
*.rbc
+Gemfile.lock
+
+.yardoc/*
+doc/*
+
View
@@ -0,0 +1,7 @@
+--no-private
+--protected
+--markup="markdown" lib/**/*.rb
+--main README.md
+--exclude jeventmachine --exclude pure_ruby
+-
+docs/*.md
View
File renamed without changes.
View
@@ -0,0 +1,3 @@
+source :rubygems
+gemspec
+
View
File renamed without changes.
View
81 README
@@ -1,81 +0,0 @@
-= RUBY/EventMachine
-
-Homepage:: http://rubyeventmachine.com
-Rubyforge Page:: http://rubyforge.org/projects/eventmachine
-Google Group:: http://groups.google.com/group/eventmachine
-RDoc:: http://eventmachine.rubyforge.org
-IRC:: ##eventmachine on irc.freenode.net
-Copyright:: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
-Email:: gmail address: garbagecat10
-
-EventMachine is copyrighted free software made available under the terms
-of either the GPL or Ruby's License. See the file COPYING for full licensing
-information.
-See EventMachine and EventMachine::Connection for documentation and
-usage examples.
-
-EventMachine implements a fast, single-threaded engine for arbitrary network
-communications. It's extremely easy to use in Ruby. EventMachine wraps all
-interactions with IP sockets, allowing programs to concentrate on the
-implementation of network protocols. It can be used to create both network
-servers and clients. To create a server or client, a Ruby program only needs
-to specify the IP address and port, and provide a Module that implements the
-communications protocol. Implementations of several standard network protocols
-are provided with the package, primarily to serve as examples. The real goal
-of EventMachine is to enable programs to easily interface with other programs
-using TCP/IP, especially if custom protocols are required.
-
-A Ruby program uses EventMachine by registering the addresses and ports of
-network servers and clients, and then entering an event-handling loop.
-EventMachine contains glue code in Ruby which will execute callbacks to
-user-supplied code for all significant events occurring in the clients
-and servers. These events include connection acceptance, startup, data-receipt,
-shutdown, and timer events. Arbitrary processing can be performed by user code
-during event callbacks, including sending data to one or more remote network
-peers, startup and shutdown of network connections, and installation of new
-event handlers.
-
-The EventMachine implements a very familiar model for network programming.
-It emphasizes: 1) the maximum possible isolation of user code from network
-objects like sockets; 2) maximum performance and scalability; and 3) extreme
-ease-of-use for user code. It attempts to provide a higher-level interface
-than similar projects which expose a variety of low-level event-handling
-and networking objects to Ruby programs.
-
-The design and implementation of EventMachine grows out of nearly ten years
-of experience writing high-performance, high-scaling network server applications.
-We have taken particular account of the challenges and lessons described as
-the "C10K problem" by Dan Kegel and others.
-
-EventMachine consists of an extension library written in C++ (which can be
-accessed from languages other than Ruby), and a Ruby module which can be dropped
-into user programs. On most platforms, EventMachine uses the
-<tt>select(2)</tt> system call,
-so it will run on a large range of Unix-like systems and on Microsoft
-Windows with good performance and scalability. On Linux 2.6 kernels, EventMachine
-automatically configures itself to use <tt>epoll(4)</tt> instead of
-<tt>select(2),</tt> so scalability on that platform can be significantly
-improved.
-
-Here's a fully-functional echo server written with EventMachine:
-
- require 'eventmachine'
-
- module EchoServer
- def post_init
- puts "-- someone connected to the echo server!"
- end
-
- def receive_data data
- send_data ">>>you sent: #{data}"
- close_connection if data =~ /quit/i
- end
-
- def unbind
- puts "-- someone disconnected from the echo server!"
- end
- end
-
- EventMachine::run {
- EventMachine::start_server "127.0.0.1", 8081, EchoServer
- }
View
109 README.md
@@ -0,0 +1,109 @@
+# About EventMachine #
+
+
+## What is EventMachine ##
+
+EventMachine is an event-driven I/O and lightweight concurrency library for Ruby.
+It provides event-driven I/O using the [Reactor pattern](http://en.wikipedia.org/wiki/Reactor_pattern),
+much like [JBoss Netty](http://www.jboss.org/netty), [Apache MINA](http://mina.apache.org/),
+Python's [Twisted](http://twistedmatrix.com), [Node.js](http://nodejs.org), libevent and libev.
+
+EventMachine is designed to simultaneously meet two key needs:
+
+ * Extremely high scalability, performance and stability for the most demanding production environments.
+ * An API that eliminates the complexities of high-performance threaded network programming,
+ allowing engineers to concentrate on their application logic.
+
+This unique combination makes EventMachine a premier choice for designers of critical networked
+applications, including Web servers and proxies, email and IM production systems, authentication/authorization
+processors, and many more.
+
+EventMachine has been around since the early 2000s and is a mature and battle tested library.
+
+
+## What EventMachine is good for? ##
+
+ * Scalable event-driven servers. Examples: [Thin](http://code.macournoyer.com/thin/) or [Goliath](https://github.com/postrank-labs/goliath/).
+ * Scalable asynchronous clients for various protocols, RESTful APIs and so on. Examples: [em-http-request](https://github.com/igrigorik/em-http-request) or [amqp gem](https://github.com/ruby-amqp/amqp).
+ * Efficient network proxies with custom logic. Examples: [Proxymachine](https://github.com/mojombo/proxymachine/).
+ * File and network monitoring tools. Examples: [eventmachine-tail](https://github.com/jordansissel/eventmachine-tail) and [logstash](https://github.com/logstash/logstash).
+
+
+
+## What platforms are supported by EventMachine? ##
+
+EventMachine supports Ruby 1.8.7, 1.9.2, REE, JRuby and **works well on Windows** as well
+as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors).
+
+
+
+## Install the gem ##
+
+Install it with [RubyGems](https://rubygems.org/)
+
+ gem install eventmachine
+
+or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
+
+ gem "eventmachine"
+
+
+
+## Getting started ##
+
+For an introduction to EventMachine, check out:
+
+ * [blog post about EventMachine by Ilya Grigorik](http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/).
+ * [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions/).
+
+
+### Server example: Echo server ###
+
+Here's a fully-functional echo server written with EventMachine:
+
+ require 'eventmachine'
+
+ module EchoServer
+ def post_init
+ puts "-- someone connected to the echo server!"
+ end
+
+ def receive_data data
+ send_data ">>>you sent: #{data}"
+ close_connection if data =~ /quit/i
+ end
+
+ def unbind
+ puts "-- someone disconnected from the echo server!"
+ end
+ end
+
+ # Note that this will block current thread.
+ EventMachine.run {
+ EventMachine.start_server "127.0.0.1", 8081, EchoServer
+ }
+
+
+## EventMachine documentation ##
+
+Currently we only have [reference documentation](http://eventmachine.rubyforge.org) and a [wiki](https://github.com/eventmachine/eventmachine/wiki).
+
+
+## Community and where to get help ##
+
+ * Join the [mailing list](http://groups.google.com/group/eventmachine) (Google Group)
+ * Join IRC channel #eventmachine on irc.freenode.net
+
+
+## License and copyright ##
+
+EventMachine is copyrighted free software made available under the terms
+of either the GPL or Ruby's License.
+
+Copyright: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
+
+
+## Alternatives ##
+
+If you are unhappy with EventMachine and want to use Ruby, check out [Cool.io](http://coolio.github.com/).
+One caveat: by May 2011, it did not support JRuby and Windows.
Oops, something went wrong.

0 comments on commit 2cd0c19

Please sign in to comment.