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 +6 -0
- data/bin/speed-server +4 -4
- data/lib/speed/version.rb +1 -1
- metadata +1 -1
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
|
|
data/bin/speed-server
CHANGED
@@ -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.
|
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.
|
101
|
+
remote_ip = client.peeraddr[3]
|
102
102
|
speed = calculate_speed do
|
103
103
|
client.read(SIZE)
|
104
104
|
client.close
|
data/lib/speed/version.rb
CHANGED