net-ping 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/lib/net/ping/icmp.rb +30 -27
- data/lib/net/ping/ping.rb +1 -1
- data/net-ping.gemspec +1 -1
- data/test/test_net_ping.rb +1 -1
- metadata +11 -4
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.3.7 - 14-Oct-2010
|
2
|
+
* Wrapped the ICMP ping in a while loop that breaks on success to prevent
|
3
|
+
the ping from failing too early. Thanks go to Benny Holmgren for the
|
4
|
+
spot and the patch.
|
5
|
+
|
1
6
|
== 1.3.6 - 4-Sep-2010
|
2
7
|
* Fixed variable naming issue in Net::Ping::External. Thanks go to taw
|
3
8
|
for the spot.
|
data/lib/net/ping/icmp.rb
CHANGED
@@ -97,33 +97,36 @@ module Net
|
|
97
97
|
|
98
98
|
begin
|
99
99
|
Timeout.timeout(@timeout){
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
100
|
+
while true
|
101
|
+
io_array = select([socket], nil, nil, timeout)
|
102
|
+
|
103
|
+
if io_array.nil? || io_array[0].empty?
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
|
107
|
+
pid = nil
|
108
|
+
seq = nil
|
109
|
+
|
110
|
+
data, sender = socket.recvfrom(1500)
|
111
|
+
port, host = Socket.unpack_sockaddr_in(sender)
|
112
|
+
type, subcode = data[20, 2].unpack('C2')
|
113
|
+
|
114
|
+
case type
|
115
|
+
when ICMP_ECHOREPLY
|
116
|
+
if data.length >= 28
|
117
|
+
pid, seq = data[24, 4].unpack('n3')
|
118
|
+
end
|
119
|
+
else
|
120
|
+
if data.length > 56
|
121
|
+
pid, seq = data[52, 4].unpack('n3')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
if pid == @pid && seq == @seq && type == ICMP_ECHOREPLY
|
126
|
+
bool = true
|
127
|
+
break
|
128
|
+
end
|
129
|
+
end
|
127
130
|
}
|
128
131
|
rescue Exception => err
|
129
132
|
@exception = err
|
data/lib/net/ping/ping.rb
CHANGED
data/net-ping.gemspec
CHANGED
data/test/test_net_ping.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 1.3.
|
9
|
+
- 7
|
10
|
+
version: 1.3.7
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Daniel J. Berger
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-14 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: test-unit
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 29
|
27
30
|
segments:
|
28
31
|
- 2
|
29
32
|
- 0
|
@@ -77,23 +80,27 @@ rdoc_options: []
|
|
77
80
|
require_paths:
|
78
81
|
- lib
|
79
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
80
84
|
requirements:
|
81
85
|
- - ">="
|
82
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
83
88
|
segments:
|
84
89
|
- 0
|
85
90
|
version: "0"
|
86
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
87
93
|
requirements:
|
88
94
|
- - ">="
|
89
95
|
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
90
97
|
segments:
|
91
98
|
- 0
|
92
99
|
version: "0"
|
93
100
|
requirements: []
|
94
101
|
|
95
102
|
rubyforge_project: shards
|
96
|
-
rubygems_version: 1.3.
|
103
|
+
rubygems_version: 1.3.7
|
97
104
|
signing_key:
|
98
105
|
specification_version: 3
|
99
106
|
summary: A ping interface for Ruby.
|