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 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
- io_array = select([socket], nil, nil, timeout)
101
-
102
- if io_array.nil? || io_array[0].empty?
103
- return false
104
- end
105
-
106
- pid = nil
107
- seq = nil
108
-
109
- data, sender = socket.recvfrom(1500)
110
- port, host = Socket.unpack_sockaddr_in(sender)
111
- type, subcode = data[20, 2].unpack('C2')
112
-
113
- case type
114
- when ICMP_ECHOREPLY
115
- if data.length >= 28
116
- pid, seq = data[24, 4].unpack('n3')
117
- end
118
- else
119
- if data.length > 56
120
- pid, seq = data[52, 4].unpack('n3')
121
- end
122
- end
123
-
124
- if pid == @pid && seq == @seq && type == ICMP_ECHOREPLY
125
- bool = true
126
- end
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
@@ -10,7 +10,7 @@ module Net
10
10
  #
11
11
  class Ping
12
12
  # The version of the net-ping library.
13
- VERSION = '1.3.6'
13
+ VERSION = '1.3.7'
14
14
 
15
15
  # The host to ping. In the case of Ping::HTTP, this is the URI.
16
16
  attr_accessor :host
data/net-ping.gemspec CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'net-ping'
6
- gem.version = '1.3.6'
6
+ gem.version = '1.3.7'
7
7
  gem.license = 'Artistic 2.0'
8
8
  gem.author = 'Daniel J. Berger'
9
9
  gem.email = 'djberg96@gmail.com'
@@ -21,6 +21,6 @@ end
21
21
 
22
22
  class TC_Net_Ping < Test::Unit::TestCase
23
23
  def test_net_ping_version
24
- assert_equal('1.3.6', Net::Ping::VERSION)
24
+ assert_equal('1.3.7', Net::Ping::VERSION)
25
25
  end
26
26
  end
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
- - 6
9
- version: 1.3.6
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-09-05 00:00:00 -06:00
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.6
103
+ rubygems_version: 1.3.7
97
104
  signing_key:
98
105
  specification_version: 3
99
106
  summary: A ping interface for Ruby.