pry-remote-em 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pry-remote-em/broker.rb +5 -5
- data/lib/pry-remote-em/server.rb +6 -5
- data/lib/pry-remote-em/version.rb +1 -1
- metadata +2 -2
data/lib/pry-remote-em/broker.rb
CHANGED
@@ -32,19 +32,19 @@ module PryRemoteEm
|
|
32
32
|
raise e
|
33
33
|
end
|
34
34
|
end
|
35
|
+
client { |c| yield self } if block_given?
|
35
36
|
end
|
36
37
|
|
37
38
|
def restart
|
38
39
|
log.info("[pry-remote-em broker] restarting on pryem://#{host}:#{port}")
|
39
|
-
|
40
|
-
|
40
|
+
@waiting = nil
|
41
|
+
@client = nil
|
42
|
+
run(@host, @port, @opts) do
|
41
43
|
PryRemoteEm.servers.each do |url, (sig, name)|
|
42
44
|
next unless EM.get_sockname(sig)
|
43
45
|
register(url, name)
|
44
46
|
end
|
45
47
|
end
|
46
|
-
@waiting = nil
|
47
|
-
@client = nil
|
48
48
|
end
|
49
49
|
|
50
50
|
def opts
|
@@ -113,7 +113,7 @@ module PryRemoteEm
|
|
113
113
|
if @waiting
|
114
114
|
@waiting << blk
|
115
115
|
else
|
116
|
-
@waiting = []
|
116
|
+
@waiting = [blk]
|
117
117
|
EM.connect(host, port, Client::Broker, @opts) do |client|
|
118
118
|
client.errback { |e| raise(e || "broker client error") }
|
119
119
|
client.callback do
|
data/lib/pry-remote-em/server.rb
CHANGED
@@ -104,11 +104,12 @@ module PryRemoteEm
|
|
104
104
|
name = Pry.view_clip(name)
|
105
105
|
PryRemoteEm.servers[url] = [server, name]
|
106
106
|
(opts[:logger] || ::Logger.new(STDERR)).info("[pry-remote-em] listening for connections on #{url}")
|
107
|
-
Broker.run(opts[:broker_host] || ENV['PRYEMBROKER'] || DEF_BROKERHOST, opts[:broker_port] || ENV['PRYEMBROKERPORT'] || DEF_BROKERPORT, opts)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
Broker.run(opts[:broker_host] || ENV['PRYEMBROKER'] || DEF_BROKERHOST, opts[:broker_port] || ENV['PRYEMBROKERPORT'] || DEF_BROKERPORT, opts) do |broker|
|
108
|
+
broker.register(url, name)
|
109
|
+
rereg = EM::PeriodicTimer.new(15) do
|
110
|
+
EM.get_sockname(server) ? broker.register(url, name) : nil #rereg.cancel
|
111
|
+
end
|
112
|
+
end # broker
|
112
113
|
url
|
113
114
|
end
|
114
115
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-remote-em
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|