ruby_skynet 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 088702cd6c216e6b48ec0124fb0ea95438be5a17
4
- data.tar.gz: 6500952161438b2dcd00f2862164260ddc1788ca
3
+ metadata.gz: 3fd7fd4822334e7d782d4dea66adfebee81ed5e6
4
+ data.tar.gz: df2655971d950f5672beadbbe324e866b24ef754
5
5
  SHA512:
6
- metadata.gz: 44c050a725b5fdf2ebda68a12be4a08117bb067f9df0bd19d4a28223e3f62bbdce5d5fe0dc715088a6857f462682dee61afc7b1e9c8843d52f3a8ee336f4165c
7
- data.tar.gz: 8cf35886b4c988835b705d39777ac3d74e87ae26fe55b9038d713f6d9f87a06c143a6d5a05ccbfa46b8da0e5c0972148c92c4328406eaf60092b17262dc1353e
6
+ metadata.gz: c40532f7c7ba9710f1aa48ee5f25fa1a6c1e0a4a1e2fb42d265309abb959e02a0dc1d40c5eada990cb0907898a04806540a1a39d3cd02e1bb2e2065ef12a4325
7
+ data.tar.gz: 1d877ccc14a6a71bd708161722e45aefbd5b529f9fc62ad6a20f4f7d393d231e4d9f808a849033b8cbfe7a79ecafe0065a65315921c34023c458beaf601a727c
@@ -27,7 +27,7 @@ module RubySkynet
27
27
 
28
28
  # Returns the local ip address being used by this machine to talk to the
29
29
  # internet. By default connects to Google and determines what IP Address is used locally
30
- def self.local_ip_address(remote_ip = '64.233.187.99')
30
+ def self.local_ip_address(remote_ip = 'google.com')
31
31
  @@local_ip_address ||= ::UDPSocket.open {|s| s.connect(remote_ip, 1); s.addr.last }
32
32
  end
33
33
 
@@ -1,3 +1,3 @@
1
1
  module RubySkynet #:nodoc
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -117,26 +117,23 @@ module RubySkynet
117
117
  end
118
118
  end
119
119
 
120
- # Service information changed, so update internal registry
120
+ # Service information created
121
121
  def service_info_created(path, value=nil)
122
122
  logger.info("service_info_created: #{path}", value)
123
123
  # path: "uuid/key"
124
124
  uuid, key = path.split('/')
125
125
 
126
- # Big Assumption: 'registered' event will be received last as true
127
- if (key == 'registered') && (value == true)
128
- server = @notifications_cache[uuid]
129
- if server && server['addr'] && server['name'] && server['version'] && server['region']
130
- hostname, port = server['addr'].split(':')
131
- add_server(File.join(server['name'], server['version'].to_s, server['region']), hostname, port)
132
- else
133
- logger.warn "Registered notification received for #{uuid} but is missing critical information. Received:", server
134
- end
135
- else
136
- (@notifications_cache[uuid] ||= ThreadSafe::Hash.new)[key] = value
126
+ server = (@notifications_cache[uuid] ||= ThreadSafe::Hash.new)
127
+ server[key] = value
128
+
129
+ # Check if service is 'registered' and has all required attributes
130
+ if (server['registered'] == true) && server['addr'] && server['name'] && server['version'] && server['region']
131
+ hostname, port = server['addr'].split(':')
132
+ add_server(File.join(server['name'], server['version'].to_s, server['region']), hostname, port)
137
133
  end
138
134
  end
139
135
 
136
+ # Service information changed
140
137
  def service_info_updated(path, value=nil)
141
138
  logger.info("service_info_updated: #{path}", value)
142
139
  # path: "uuid/key"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_skynet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2013-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic_logger