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.
@@ -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
- run(@host, @port, @opts)
40
- EM::Timer.new(rand(0.9)) do
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
@@ -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
- EM::Timer.new(rand(0.9)) { 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
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
 
@@ -1,3 +1,3 @@
1
1
  module PryRemoteEm
2
- VERSION = '0.7.1'
2
+ VERSION = '0.7.2'
3
3
  end
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.1
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-15 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine