59 ### with any detected errors. |
59 ### with any detected errors. |
60 ### |
60 ### |
61 def handle_results( pid, stdout, stderr ) |
61 def handle_results( pid, stdout, stderr ) |
62 # 8.8.8.8 is alive (32.1 ms) |
62 # 8.8.8.8 is alive (32.1 ms) |
63 # 8.8.4.4 is alive (14.9 ms) |
63 # 8.8.4.4 is alive (14.9 ms) |
|
64 # 1.1.1.1 is alive (236 ms) |
64 # 8.8.0.1 is unreachable |
65 # 8.8.0.1 is unreachable |
65 |
66 |
66 return stdout.each_line.with_object({}) do |line, hash| |
67 return stdout.each_line.with_object({}) do |line, hash| |
67 address, remainder = line.split( ' ', 2 ) |
68 address, remainder = line.split( ' ', 2 ) |
68 identifier = self.identifiers[ address ] or next |
69 identifier = self.identifiers[ address ] or next |
69 |
70 |
70 if remainder =~ /is alive \((\d+\.\d+) ms\)/ |
71 if remainder =~ /is alive \((\d+(?:\.\d+)?) ms\)/ |
71 hash[ identifier ] = { rtt: Float( $1 ) } |
72 hash[ identifier ] = { rtt: Float( $1 ) } |
72 else |
73 else |
73 hash[ identifier ] = { error: remainder.chomp } |
74 hash[ identifier ] = { error: remainder.chomp } |
74 end |
75 end |
75 end |
76 end |