rainbows 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GIT-VERSION-GEN +1 -1
- data/lib/rainbows/const.rb +1 -1
- data/lib/rainbows/event_machine.rb +17 -2
- data/t/test_isolate_cramp.rb +1 -1
- metadata +4 -4
data/GIT-VERSION-GEN
CHANGED
data/lib/rainbows/const.rb
CHANGED
@@ -50,6 +50,21 @@ module Rainbows::EventMachine
|
|
50
50
|
|
51
51
|
include Rainbows::Base
|
52
52
|
|
53
|
+
# Cramp (and possibly others) can subclass Rainbows::EventMachine::Client
|
54
|
+
# and provide the :em_client_class option. We /don't/ want to load
|
55
|
+
# Rainbows::EventMachine::Client in the master process since we need
|
56
|
+
# reloadability.
|
57
|
+
def em_client_class
|
58
|
+
case klass = Rainbows::O[:em_client_class]
|
59
|
+
when Proc
|
60
|
+
klass.call # e.g.: proc { Cramp::WebSocket::Rainbows }
|
61
|
+
when Symbol, String
|
62
|
+
eval(klass.to_s) # Object.const_get won't resolve multi-level paths
|
63
|
+
else # @use should be either :EventMachine or :NeverBlock
|
64
|
+
Rainbows.const_get(@use).const_get(:Client)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
53
68
|
# runs inside each forked worker, this sits around and waits
|
54
69
|
# for connections and doesn't die until the parent dies (or is
|
55
70
|
# given a INT, QUIT, or TERM signal)
|
@@ -63,11 +78,11 @@ module Rainbows::EventMachine
|
|
63
78
|
EM.epoll
|
64
79
|
EM.kqueue
|
65
80
|
logger.info "#@use: epoll=#{EM.epoll?} kqueue=#{EM.kqueue?}"
|
66
|
-
client_class =
|
81
|
+
client_class = em_client_class
|
67
82
|
max = worker_connections + LISTENERS.size
|
68
83
|
Rainbows::EventMachine::Server.const_set(:MAX, max)
|
69
84
|
Rainbows::EventMachine::Server.const_set(:CL, client_class)
|
70
|
-
|
85
|
+
Rainbows::EventMachine::Client.const_set(:APP, Rainbows.server.app)
|
71
86
|
EM.run {
|
72
87
|
conns = EM.instance_variable_get(:@conns) or
|
73
88
|
raise RuntimeError, "EM @conns instance variable not accessible!"
|
data/t/test_isolate_cramp.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 4
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 4.
|
10
|
+
version: 4.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rainbows! hackers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rack
|