eventmachine 1.0.0.beta.3-x86-mingw32 → 1.0.0.beta.4.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.yardopts +5 -1
- data/{docs/GNU → GNU} +0 -0
- data/Gemfile +1 -0
- data/{docs/COPYING → LICENSE} +0 -0
- data/README.md +109 -0
- data/Rakefile +8 -0
- data/docs/DocumentationGuidesIndex.md +27 -0
- data/docs/GettingStarted.md +521 -0
- data/docs/{ChangeLog → old/ChangeLog} +0 -0
- data/docs/{DEFERRABLES → old/DEFERRABLES} +0 -0
- data/docs/{EPOLL → old/EPOLL} +0 -0
- data/docs/{INSTALL → old/INSTALL} +0 -0
- data/docs/{KEYBOARD → old/KEYBOARD} +0 -0
- data/docs/{LEGAL → old/LEGAL} +0 -0
- data/docs/{LIGHTWEIGHT_CONCURRENCY → old/LIGHTWEIGHT_CONCURRENCY} +0 -0
- data/docs/{PURE_RUBY → old/PURE_RUBY} +0 -0
- data/docs/{RELEASE_NOTES → old/RELEASE_NOTES} +0 -0
- data/docs/{SMTP → old/SMTP} +0 -0
- data/docs/{SPAWNED_PROCESSES → old/SPAWNED_PROCESSES} +0 -0
- data/docs/{TODO → old/TODO} +0 -0
- data/eventmachine.gemspec +5 -2
- data/examples/guides/getting_started/01_eventmachine_echo_server.rb +18 -0
- data/examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb +22 -0
- data/examples/guides/getting_started/03_simple_chat_server.rb +149 -0
- data/examples/guides/getting_started/04_simple_chat_server_step_one.rb +27 -0
- data/examples/guides/getting_started/05_simple_chat_server_step_two.rb +43 -0
- data/examples/guides/getting_started/06_simple_chat_server_step_three.rb +98 -0
- data/examples/guides/getting_started/07_simple_chat_server_step_four.rb +121 -0
- data/examples/guides/getting_started/08_simple_chat_server_step_five.rb +141 -0
- data/examples/{ex_channel.rb → old/ex_channel.rb} +3 -3
- data/examples/{ex_queue.rb → old/ex_queue.rb} +0 -0
- data/examples/{ex_tick_loop_array.rb → old/ex_tick_loop_array.rb} +0 -0
- data/examples/{ex_tick_loop_counter.rb → old/ex_tick_loop_counter.rb} +0 -0
- data/examples/{helper.rb → old/helper.rb} +0 -0
- data/ext/cmain.cpp +3 -3
- data/ext/ed.cpp +90 -15
- data/ext/ed.h +5 -5
- data/ext/em.cpp +48 -56
- data/ext/em.h +12 -2
- data/ext/extconf.rb +3 -3
- data/ext/fastfilereader/extconf.rb +1 -1
- data/ext/pipe.cpp +2 -2
- data/ext/project.h +1 -1
- data/ext/rubymain.cpp +48 -3
- data/ext/ssl.cpp +5 -0
- data/java/src/com/rubyeventmachine/EmReactor.java +2 -2
- data/lib/em/buftok.rb +35 -63
- data/lib/em/callback.rb +43 -11
- data/lib/em/channel.rb +21 -14
- data/lib/em/completion.rb +304 -0
- data/lib/em/connection.rb +339 -209
- data/lib/em/deferrable.rb +4 -0
- data/lib/em/deferrable/pool.rb +2 -0
- data/lib/em/file_watch.rb +37 -18
- data/lib/em/iterator.rb +42 -42
- data/lib/em/pool.rb +146 -0
- data/lib/em/process_watch.rb +5 -4
- data/lib/em/processes.rb +8 -4
- data/lib/em/protocols/httpclient.rb +22 -11
- data/lib/em/protocols/httpclient2.rb +15 -5
- data/lib/em/protocols/line_protocol.rb +2 -1
- data/lib/em/protocols/memcache.rb +17 -9
- data/lib/em/protocols/object_protocol.rb +2 -1
- data/lib/em/protocols/postgres3.rb +8 -9
- data/lib/em/protocols/smtpclient.rb +19 -11
- data/lib/em/protocols/smtpserver.rb +1 -1
- data/lib/em/protocols/stomp.rb +8 -6
- data/lib/em/protocols/tcptest.rb +3 -2
- data/lib/em/pure_ruby.rb +212 -208
- data/lib/em/queue.rb +22 -13
- data/lib/em/resolver.rb +70 -64
- data/lib/em/spawnable.rb +6 -3
- data/lib/em/streamer.rb +33 -45
- data/lib/em/threaded_resource.rb +90 -0
- data/lib/em/timers.rb +6 -2
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +538 -602
- data/lib/jeventmachine.rb +22 -1
- data/tasks/package.rake +12 -2
- data/tasks/test.rake +1 -0
- data/tests/em_test_helper.rb +12 -3
- data/tests/test_completion.rb +177 -0
- data/tests/test_epoll.rb +2 -2
- data/tests/test_httpclient.rb +9 -9
- data/tests/test_httpclient2.rb +11 -9
- data/tests/test_ltp.rb +2 -10
- data/tests/test_pool.rb +128 -0
- data/tests/test_processes.rb +20 -2
- data/tests/test_queue.rb +8 -0
- data/tests/test_resolver.rb +1 -1
- data/tests/test_set_sock_opt.rb +37 -0
- data/tests/test_shutdown_hooks.rb +23 -0
- data/tests/test_threaded_resource.rb +53 -0
- data/tests/test_unbind_reason.rb +31 -0
- metadata +96 -32
- data/README +0 -81
- data/tasks/doc.rake +0 -30
data/README
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
= RUBY/EventMachine
|
2
|
-
|
3
|
-
Homepage:: http://rubyeventmachine.com
|
4
|
-
Rubyforge Page:: http://rubyforge.org/projects/eventmachine
|
5
|
-
Google Group:: http://groups.google.com/group/eventmachine
|
6
|
-
RDoc:: http://eventmachine.rubyforge.org
|
7
|
-
IRC:: #eventmachine on irc.freenode.net
|
8
|
-
Copyright:: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
-
Email:: gmail address: garbagecat10
|
10
|
-
|
11
|
-
EventMachine is copyrighted free software made available under the terms
|
12
|
-
of either the GPL or Ruby's License. See the file COPYING for full licensing
|
13
|
-
information.
|
14
|
-
See EventMachine and EventMachine::Connection for documentation and
|
15
|
-
usage examples.
|
16
|
-
|
17
|
-
EventMachine implements a fast, single-threaded engine for arbitrary network
|
18
|
-
communications. It's extremely easy to use in Ruby. EventMachine wraps all
|
19
|
-
interactions with IP sockets, allowing programs to concentrate on the
|
20
|
-
implementation of network protocols. It can be used to create both network
|
21
|
-
servers and clients. To create a server or client, a Ruby program only needs
|
22
|
-
to specify the IP address and port, and provide a Module that implements the
|
23
|
-
communications protocol. Implementations of several standard network protocols
|
24
|
-
are provided with the package, primarily to serve as examples. The real goal
|
25
|
-
of EventMachine is to enable programs to easily interface with other programs
|
26
|
-
using TCP/IP, especially if custom protocols are required.
|
27
|
-
|
28
|
-
A Ruby program uses EventMachine by registering the addresses and ports of
|
29
|
-
network servers and clients, and then entering an event-handling loop.
|
30
|
-
EventMachine contains glue code in Ruby which will execute callbacks to
|
31
|
-
user-supplied code for all significant events occurring in the clients
|
32
|
-
and servers. These events include connection acceptance, startup, data-receipt,
|
33
|
-
shutdown, and timer events. Arbitrary processing can be performed by user code
|
34
|
-
during event callbacks, including sending data to one or more remote network
|
35
|
-
peers, startup and shutdown of network connections, and installation of new
|
36
|
-
event handlers.
|
37
|
-
|
38
|
-
The EventMachine implements a very familiar model for network programming.
|
39
|
-
It emphasizes: 1) the maximum possible isolation of user code from network
|
40
|
-
objects like sockets; 2) maximum performance and scalability; and 3) extreme
|
41
|
-
ease-of-use for user code. It attempts to provide a higher-level interface
|
42
|
-
than similar projects which expose a variety of low-level event-handling
|
43
|
-
and networking objects to Ruby programs.
|
44
|
-
|
45
|
-
The design and implementation of EventMachine grows out of nearly ten years
|
46
|
-
of experience writing high-performance, high-scaling network server applications.
|
47
|
-
We have taken particular account of the challenges and lessons described as
|
48
|
-
the "C10K problem" by Dan Kegel and others.
|
49
|
-
|
50
|
-
EventMachine consists of an extension library written in C++ (which can be
|
51
|
-
accessed from languages other than Ruby), and a Ruby module which can be dropped
|
52
|
-
into user programs. On most platforms, EventMachine uses the
|
53
|
-
<tt>select(2)</tt> system call,
|
54
|
-
so it will run on a large range of Unix-like systems and on Microsoft
|
55
|
-
Windows with good performance and scalability. On Linux 2.6 kernels, EventMachine
|
56
|
-
automatically configures itself to use <tt>epoll(4)</tt> instead of
|
57
|
-
<tt>select(2),</tt> so scalability on that platform can be significantly
|
58
|
-
improved.
|
59
|
-
|
60
|
-
Here's a fully-functional echo server written with EventMachine:
|
61
|
-
|
62
|
-
require 'eventmachine'
|
63
|
-
|
64
|
-
module EchoServer
|
65
|
-
def post_init
|
66
|
-
puts "-- someone connected to the echo server!"
|
67
|
-
end
|
68
|
-
|
69
|
-
def receive_data data
|
70
|
-
send_data ">>>you sent: #{data}"
|
71
|
-
close_connection if data =~ /quit/i
|
72
|
-
end
|
73
|
-
|
74
|
-
def unbind
|
75
|
-
puts "-- someone disconnected from the echo server!"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
EventMachine::run {
|
80
|
-
EventMachine::start_server "127.0.0.1", 8081, EchoServer
|
81
|
-
}
|
data/tasks/doc.rake
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
rdoc_task_type = begin
|
2
|
-
require 'rdoc/task'
|
3
|
-
RDoc::Task
|
4
|
-
rescue LoadError
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
Rake::RDocTask
|
7
|
-
end
|
8
|
-
|
9
|
-
df = begin; require 'rdoc/rdoc'; require 'rdoc/generator/darkfish'; true; rescue LoadError; end
|
10
|
-
|
11
|
-
rdtask = rdoc_task_type.new do |rd|
|
12
|
-
rd.title = GEMSPEC.name
|
13
|
-
rd.rdoc_dir = 'rdoc'
|
14
|
-
rd.main = "README"
|
15
|
-
rd.rdoc_files.include("lib/**/*.rb", *GEMSPEC.extra_rdoc_files)
|
16
|
-
rd.rdoc_files.exclude(*%w(lib/em/version lib/emva lib/evma/ lib/pr_eventmachine lib/jeventmachine))
|
17
|
-
rd.template = 'darkfish' if df
|
18
|
-
end
|
19
|
-
|
20
|
-
Rake::Task[:clean].enhance [:clobber_rdoc]
|
21
|
-
|
22
|
-
desc 'Generate and open documentation'
|
23
|
-
task :docs => :rdoc do
|
24
|
-
case RUBY_PLATFORM
|
25
|
-
when /darwin/ ; sh 'open rdoc/index.html'
|
26
|
-
when /mswin|mingw/ ; sh 'start rdoc\index.html'
|
27
|
-
else
|
28
|
-
sh 'firefox rdoc/index.html'
|
29
|
-
end
|
30
|
-
end
|