speed-test 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/speed CHANGED
@@ -78,6 +78,12 @@ begin
78
78
  rescue Errno::ECONNREFUSED
79
79
  $stderr.puts "Impossible to connect to #{host}. Is the daemon running?"
80
80
  exit
81
+ rescue Errno::EPIPE
82
+ $stderr.puts "Connection was Interrupted"
83
+ exit
84
+ rescue Errno::ECONNRESET
85
+ $stderr.puts "Connection was reset"
86
+ exit
81
87
  end
82
88
 
83
89
 
@@ -19,9 +19,9 @@ require 'timeout'
19
19
  upload_server = TCPServer.new(16001) and info("Upload Server listening at 16001")
20
20
 
21
21
  def shutdown
22
- download_server.shutdown
22
+ download_server.shutdown rescue nil
23
23
  info("Downlod server shutdown")
24
- upload_server.shutdown
24
+ upload_server.shutdown rescue nil
25
25
  info("Upload server shutdown")
26
26
  exit
27
27
  end
@@ -87,7 +87,7 @@ require 'timeout'
87
87
  when download_server
88
88
  process_client do
89
89
  client = download_server.accept
90
- remote_ip = client.remote_address.ip_address
90
+ remote_ip = client.peeraddr[3]
91
91
 
92
92
  speed = calculate_speed do
93
93
  client.write(DATA)
@@ -98,7 +98,7 @@ require 'timeout'
98
98
  when upload_server
99
99
  process_client do
100
100
  client = upload_server.accept
101
- remote_ip = client.remote_address.ip_address
101
+ remote_ip = client.peeraddr[3]
102
102
  speed = calculate_speed do
103
103
  client.read(SIZE)
104
104
  client.close
@@ -1,3 +1,3 @@
1
1
  module Speed
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speed-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: