net-ping 1.7.5 → 1.7.6

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: 6c09b778ab3eddc24d819fc4855f648350760930
4
- data.tar.gz: 209507d7dafc6ebe9b8229c27c4f9be27aa54e70
3
+ metadata.gz: 96c46fa2d17c2e28a06b71883b77a7a5a67f8ceb
4
+ data.tar.gz: 8866c7f3dd99b1206be6d1de5af8c1c55e6e046e
5
5
  SHA512:
6
- metadata.gz: a06111adfb673c48c85f6fc4ff993c3fce368cdcee0f7cc47fb9a651a198cf550847fade4df2dfcb57c071240690ac05db1c8ec7a6189c1226a124265703781f
7
- data.tar.gz: 1c2e9622a0a092ded3f1cd6bae7b15cdb382183eadcafcbfa73e4dc4bedcb3e09d5247e2bf752c3fe40f76eadfba3c2463c4ae4e6fc2fe48072be37bfffa9b3a
6
+ metadata.gz: 2c74009e6ff5a7c497f7286260b7aa8570a669747943eb337f8850cbf111516a70bf8d74742bb697680c258c3dddc2f22e840dd5c2da3b23d6ff0e81d3db1022
7
+ data.tar.gz: a2735b50295f1d9e2a3f359341777f951dca9c6e4e415f4f816358d35e399f0fe771e4093ec57131e8720b18d93c0e4b5e9c9ed5ad993caf3f5e77be7a9189c2
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.7.6 - 13-Dec-2014
2
+ * Changed TCP handling yet again, as it was returning false positives. Thanks
3
+ go to Marcos Piccinini for the spot.
4
+
1
5
  == 1.7.5 - 2-Nov-2014
2
6
  * Added packet count and intervals for external pings. Thanks go to Jack Hayter
3
7
  for the patch.
data/Rakefile CHANGED
@@ -20,7 +20,11 @@ namespace 'gem' do
20
20
  desc 'Install the net-ping gem'
21
21
  task :install => [:create] do
22
22
  gem_file = Dir["*.gem"].first
23
- sh "gem install -l #{gem_file}"
23
+ if RUBY_PLATFORM == 'java'
24
+ sh "jruby -S gem install -l #{gem_file}"
25
+ else
26
+ sh "gem install -l #{gem_file}"
27
+ end
24
28
  end
25
29
  end
26
30
 
data/lib/net/ping.rb CHANGED
@@ -4,14 +4,14 @@
4
4
  #
5
5
  require 'rbconfig'
6
6
 
7
- require File.join(File.dirname(__FILE__), 'ping/tcp')
8
- require File.join(File.dirname(__FILE__), 'ping/udp')
9
- require File.join(File.dirname(__FILE__), 'ping/icmp')
10
- require File.join(File.dirname(__FILE__), 'ping/external')
11
- require File.join(File.dirname(__FILE__), 'ping/http')
7
+ require_relative 'ping/tcp'
8
+ require_relative 'ping/udp'
9
+ require_relative 'ping/icmp'
10
+ require_relative 'ping/external'
11
+ require_relative 'ping/http'
12
12
 
13
13
  RbConfig = Config unless Object.const_defined?(:RbConfig)
14
14
 
15
15
  if File::ALT_SEPARATOR
16
- require File.join(File.dirname(__FILE__), 'ping/wmi')
16
+ require_relative 'ping/wmi'
17
17
  end
data/lib/net/ping/ping.rb CHANGED
@@ -10,7 +10,7 @@ module Net
10
10
  #
11
11
  class Ping
12
12
  # The version of the net-ping library.
13
- VERSION = '1.7.5'
13
+ VERSION = '1.7.6'
14
14
 
15
15
  # The host to ping. In the case of Ping::HTTP, this is the URI.
16
16
  attr_accessor :host
data/lib/net/ping/tcp.rb CHANGED
@@ -68,17 +68,23 @@ module Net
68
68
 
69
69
  resp = IO.select(nil, [sock], nil, timeout)
70
70
 
71
- if @@service_check
72
- bool = true
73
- elsif resp.nil?
74
- # Assume ECONNREFUSED at this point
75
- @exception = Errno::ECONNREFUSED
71
+ if resp.nil? # Assume ECONNREFUSED if nil
72
+ if @@service_check
73
+ bool = true
74
+ else
75
+ bool = false
76
+ @exception = Errno::ECONNREFUSED
77
+ end
76
78
  else
77
79
  sockopt = sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
78
80
 
79
- # Check to see if ECONNREFUSED actually occurred.
80
- if sockopt.int == Errno::ECONNREFUSED::Errno
81
- @exception = Errno::ECONNREFUSED
81
+ if sockopt.int != 0
82
+ if @@service_check && sockopt.int == Errno::ECONNREFUSED::Errno
83
+ bool = true
84
+ else
85
+ bool = false
86
+ @exception = SystemCallError.new(sockopt.int)
87
+ end
82
88
  else
83
89
  bool = true
84
90
  end
data/net-ping.gemspec CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'net-ping'
6
- spec.version = '1.7.5'
6
+ spec.version = '1.7.6'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.author = 'Daniel J. Berger'
9
9
  spec.email = 'djberg96@gmail.com'
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  if File::ALT_SEPARATOR
25
25
  require 'rbconfig'
26
- arch = RbConfig::CONFIG['build_os']
26
+ arch = RbConfig::CONFIG['build_os'] || 'mingw32' # JRuby
27
27
  spec.platform = Gem::Platform.new(['universal', arch])
28
28
  spec.platform.version = nil
29
29
 
@@ -28,7 +28,7 @@ end
28
28
 
29
29
  class TC_Net_Ping < Test::Unit::TestCase
30
30
  def test_net_ping_version
31
- assert_equal('1.7.5', Net::Ping::VERSION)
31
+ assert_equal('1.7.6', Net::Ping::VERSION)
32
32
  end
33
33
  end
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-02 00:00:00.000000000 Z
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.2.2
113
+ rubygems_version: 2.4.5
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: A ping interface for Ruby.