net-ping 1.7.4 → 1.7.5
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.
- checksums.yaml +4 -4
- data/CHANGES +6 -0
- data/MANIFEST +2 -1
- data/README +4 -0
- data/Rakefile +1 -1
- data/lib/net/ping/external.rb +15 -7
- data/lib/net/ping/ping.rb +1 -1
- data/lib/net/ping/tcp.rb +12 -7
- data/net-ping.gemspec +1 -1
- data/test/test_net_ping.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c09b778ab3eddc24d819fc4855f648350760930
|
4
|
+
data.tar.gz: 209507d7dafc6ebe9b8229c27c4f9be27aa54e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06111adfb673c48c85f6fc4ff993c3fce368cdcee0f7cc47fb9a651a198cf550847fade4df2dfcb57c071240690ac05db1c8ec7a6189c1226a124265703781f
|
7
|
+
data.tar.gz: 1c2e9622a0a092ded3f1cd6bae7b15cdb382183eadcafcbfa73e4dc4bedcb3e09d5247e2bf752c3fe40f76eadfba3c2463c4ae4e6fc2fe48072be37bfffa9b3a
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.7.5 - 2-Nov-2014
|
2
|
+
* Added packet count and intervals for external pings. Thanks go to Jack Hayter
|
3
|
+
for the patch.
|
4
|
+
* No longer report closed TCP port as active. Thanks go to Joshua Yanovski for
|
5
|
+
the spot and patch.
|
6
|
+
|
1
7
|
== 1.7.4 - 16-Apr-2014
|
2
8
|
* Remove the Timeout block for the Ping::HTTP class because it wasn't working
|
3
9
|
with JRuby. Instead, we use the builtin open_timeout and read_timeout
|
data/MANIFEST
CHANGED
data/README
CHANGED
@@ -13,6 +13,10 @@
|
|
13
13
|
== Installation
|
14
14
|
gem install net-ping
|
15
15
|
|
16
|
+
== Maintainer Wanted!
|
17
|
+
I would very much like to turn this gem over to someone who is using it
|
18
|
+
more actively than I am. Please let me know if you are interested!
|
19
|
+
|
16
20
|
== Notes
|
17
21
|
Please read the documentation under the 'doc' directory. Especially pay
|
18
22
|
attention to the documentation pertaining to ECONNREFUSED and TCP pings.
|
data/Rakefile
CHANGED
data/lib/net/ping/external.rb
CHANGED
@@ -15,7 +15,15 @@ module Net
|
|
15
15
|
# contain a string indicating what went wrong. If the ping succeeded then
|
16
16
|
# the Ping::External#warning method may or may not contain a value.
|
17
17
|
#
|
18
|
-
def ping(host = @host)
|
18
|
+
def ping(host = @host, count = 1, interval = 1, timeout = @timeout)
|
19
|
+
|
20
|
+
raise "Count must be an integer" unless count.is_a? Integer
|
21
|
+
raise "Timeout must be a number" unless timeout.is_a? Numeric
|
22
|
+
|
23
|
+
unless interval.is_a?(Numeric) && interval >= 0.2
|
24
|
+
raise "Interval must be a decimal greater than or equal to 0.2"
|
25
|
+
end
|
26
|
+
|
19
27
|
super(host)
|
20
28
|
|
21
29
|
pcmd = ['ping']
|
@@ -23,17 +31,17 @@ module Net
|
|
23
31
|
|
24
32
|
case RbConfig::CONFIG['host_os']
|
25
33
|
when /linux/i
|
26
|
-
pcmd += ['-c',
|
34
|
+
pcmd += ['-c', count.to_s, '-W', timeout.to_s, host, '-i', interval.to_s]
|
27
35
|
when /aix/i
|
28
|
-
pcmd += ['-c',
|
36
|
+
pcmd += ['-c', count.to_s, '-w', timeout.to_s, host]
|
29
37
|
when /bsd|osx|mach|darwin/i
|
30
|
-
pcmd += ['-c',
|
38
|
+
pcmd += ['-c', count.to_s, '-t', timeout.to_s, host]
|
31
39
|
when /solaris|sunos/i
|
32
|
-
pcmd += [host,
|
40
|
+
pcmd += [host, timeout.to_s]
|
33
41
|
when /hpux/i
|
34
|
-
pcmd += [host,
|
42
|
+
pcmd += [host, "-n#{count.to_s}", '-m', timeout.to_s]
|
35
43
|
when /win32|windows|msdos|mswin|cygwin|mingw/i
|
36
|
-
pcmd += ['-n',
|
44
|
+
pcmd += ['-n', count.to_s, '-w', (timeout * 1000).to_s, host]
|
37
45
|
else
|
38
46
|
pcmd += [host]
|
39
47
|
end
|
data/lib/net/ping/ping.rb
CHANGED
data/lib/net/ping/tcp.rb
CHANGED
@@ -68,15 +68,20 @@ module Net
|
|
68
68
|
|
69
69
|
resp = IO.select(nil, [sock], nil, timeout)
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
if @@service_check
|
72
|
+
bool = true
|
73
|
+
elsif resp.nil?
|
74
|
+
# Assume ECONNREFUSED at this point
|
75
|
+
@exception = Errno::ECONNREFUSED
|
76
|
+
else
|
77
|
+
sockopt = sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
|
78
|
+
|
79
|
+
# Check to see if ECONNREFUSED actually occurred.
|
80
|
+
if sockopt.int == Errno::ECONNREFUSED::Errno
|
76
81
|
@exception = Errno::ECONNREFUSED
|
82
|
+
else
|
83
|
+
bool = true
|
77
84
|
end
|
78
|
-
else
|
79
|
-
bool = true
|
80
85
|
end
|
81
86
|
ensure
|
82
87
|
sock.close if sock
|
data/net-ping.gemspec
CHANGED
data/test/test_net_ping.rb
CHANGED
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.
|
4
|
+
version: 1.7.5
|
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
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|