rgossip2 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rgossip2/client.rb +12 -0
  2. metadata +11 -11
@@ -52,6 +52,8 @@ module RGossip2
52
52
  addr = name2addr(i)
53
53
  # 自ノードはスキップ
54
54
  next if addr == @address
55
+ # つながらない場合はスキップ
56
+ next unless connectable?(addr, @context.port)
55
57
  @node_list[addr] = create(Node, @node_list, @dead_list, addr, nil, nil)
56
58
  end
57
59
 
@@ -201,6 +203,16 @@ module RGossip2
201
203
  end
202
204
  end
203
205
 
206
+ def connectable?(host, port)
207
+ s = UDPSocket.new
208
+ s.connect(host, port)
209
+ s.close
210
+ return true
211
+ rescue => e
212
+ @logger.debug("#{host}:#{port}: #{e.message}")
213
+ return false
214
+ end
215
+
204
216
  end # Client
205
217
 
206
218
  end # RGossip2
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgossip2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-30 00:00:00 +00:00
18
+ date: 2012-01-19 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -43,14 +43,14 @@ extra_rdoc_files: []
43
43
  files:
44
44
  - README
45
45
  - bin/gossip
46
- - lib/rgossip2/receiver.rb
47
- - lib/rgossip2/timer.rb
48
- - lib/rgossip2/gossipper.rb
49
- - lib/rgossip2/node.rb
50
46
  - lib/rgossip2/client.rb
51
47
  - lib/rgossip2/context.rb
52
- - lib/rgossip2/node_list.rb
53
48
  - lib/rgossip2/context_helper.rb
49
+ - lib/rgossip2/gossipper.rb
50
+ - lib/rgossip2/node.rb
51
+ - lib/rgossip2/node_list.rb
52
+ - lib/rgossip2/receiver.rb
53
+ - lib/rgossip2/timer.rb
54
54
  - lib/rgossip2.rb
55
55
  has_rdoc: true
56
56
  homepage: https://bitbucket.org/winebarrel/rgossip2
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements: []
83
83
 
84
84
  rubyforge_project:
85
- rubygems_version: 1.3.7
85
+ rubygems_version: 1.5.3
86
86
  signing_key:
87
87
  specification_version: 3
88
88
  summary: Basic implementation of a gossip protocol. This is a porting of Java implementation. see http://code.google.com/p/gossip-protocol-java/