tarbit 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/tarbit +0 -3
- data/lib/tarbit/server.rb +5 -10
- data/lib/tarbit/statistic_watcher.rb +3 -2
- data/lib/tarbit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 182034a90913782f8971a89c33dcc160273bab47bfcb44204dbb7edf9f50317e
|
4
|
+
data.tar.gz: da2d30e40c2ff76062064208df8d5e30883e5af05b75acc3fd34b2d842aec1f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 264c074daad6d84d9413497298bccb8130248d34cd5e37624bf5487bc4b8b29ae2c06e7c33ccf66803a8a783c49562f0964b19d523843fa0c33f39eb80d741b9
|
7
|
+
data.tar.gz: d73c1f425d01bae5159a1912ee5790182fe79b0bc5e46f98b981326ac77dc48650703f97822f98d08e4ba8af0d61c882fd0eae7e90dc2b43eaff03e1e7376b91
|
data/Gemfile.lock
CHANGED
data/bin/tarbit
CHANGED
@@ -26,9 +26,6 @@ command :serve do |c|
|
|
26
26
|
statistic = Tarbit::StatisticWatcher.new(server, options.interval)
|
27
27
|
|
28
28
|
Async do |task|
|
29
|
-
Async.logger.info "============================================================"
|
30
|
-
Async.logger.info "Starting tarbit on port #{options.port || 22} creating time points every #{options.interval || 600} seconds"
|
31
|
-
Async.logger.info "============================================================"
|
32
29
|
statistic.watch
|
33
30
|
server.run
|
34
31
|
end
|
data/lib/tarbit/server.rb
CHANGED
@@ -11,21 +11,15 @@ module Tarbit
|
|
11
11
|
class Server
|
12
12
|
attr_reader :connections
|
13
13
|
|
14
|
-
def initialize(port
|
14
|
+
def initialize(port)
|
15
15
|
@connections = []
|
16
|
-
@port = port.to_i
|
16
|
+
@port = port.nil? ? 22 : port.to_i
|
17
|
+
Async.logger.info "Server - Starting tarbit on port #{@port}"
|
17
18
|
end
|
18
19
|
|
19
20
|
def run
|
20
21
|
endpoint = Async::IO::Endpoint.parse("tcp://0.0.0.0:#{@port}")
|
21
22
|
|
22
|
-
Async do |task|
|
23
|
-
while true
|
24
|
-
task.sleep 1
|
25
|
-
Async.logger.info "Connection count: #{@connections.size}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
23
|
Async do |task|
|
30
24
|
endpoint.accept do |peer|
|
31
25
|
stream = Async::IO::Stream.new(peer)
|
@@ -40,10 +34,11 @@ module Tarbit
|
|
40
34
|
|
41
35
|
while true do
|
42
36
|
task.sleep 60
|
43
|
-
if stream.eof? || stream.closed? || stream.io.closed?
|
37
|
+
if stream.eof? || stream.closed? || stream.io.closed? # Todo validate if flush is the problem here
|
44
38
|
raise Async::TimeoutError.new
|
45
39
|
end
|
46
40
|
stream.write "#{rand(10)}\r\n"
|
41
|
+
#stream.flush
|
47
42
|
end
|
48
43
|
rescue StandardError => e
|
49
44
|
@connections = @connections.reject { |stats| stats.fetch(:id) == id }
|
@@ -5,10 +5,11 @@ require 'json'
|
|
5
5
|
module Tarbit
|
6
6
|
class StatisticWatcher
|
7
7
|
|
8
|
-
def initialize(server, interval
|
8
|
+
def initialize(server, interval)
|
9
9
|
@server = server
|
10
|
-
@interval = interval.to_i
|
10
|
+
@interval = interval.nil? ? 600 : interval.to_i
|
11
11
|
@history = []
|
12
|
+
Async.logger.info "SatisticWatcher - Starting watcher with interval #{@interval}"
|
12
13
|
end
|
13
14
|
|
14
15
|
def watch
|
data/lib/tarbit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tarbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas Hanft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|