rsence-pre 2.3.0.4 → 2.3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rsence/argv/test_port.rb +16 -9
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0.4.pre
1
+ 2.3.0.5.pre
@@ -6,20 +6,26 @@ module ArgvUtil
6
6
  # Automatically replaces '0.0.0.0' with '127.0.0.1'
7
7
  def test_port( port, addr='127.0.0.1' )
8
8
  require 'socket'
9
+ require 'timeout'
9
10
  begin
10
11
  addr = '127.0.0.1' if addr == '0.0.0.0'
11
- if RUBY_VERSION.to_f >= 1.9
12
- sock = TCPSocket.open( addr, port )
13
- else
14
- begin
15
- sock = TCPsocket.open( addr, port )
16
- rescue NameError => e
17
- warn "TCPsocket not available, trying TCPSocket.."
12
+ timeout(1) do
13
+ if RUBY_VERSION.to_f >= 1.9
18
14
  sock = TCPSocket.open( addr, port )
15
+ else
16
+ begin
17
+ sock = TCPsocket.open( addr, port )
18
+ rescue NameError => e # Rubinius
19
+ warn "TCPsocket not available, trying TCPSocket.."
20
+ sock = TCPSocket.open( addr, port )
21
+ end
19
22
  end
23
+ sock.close
20
24
  end
21
- sock.close
22
25
  return true
26
+ rescue Timeout::Error
27
+ puts "Address #{addr} port #{port} timed out"
28
+ return false
23
29
  rescue Errno::ECONNREFUSED
24
30
  return false
25
31
  rescue => e
@@ -29,4 +35,5 @@ module ArgvUtil
29
35
  end
30
36
 
31
37
  end
32
- end
38
+ end
39
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.4
4
+ version: 2.3.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-31 00:00:00.000000000 Z
13
+ date: 2012-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps