netsoul 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/netsoul-ruby +12 -6
- data/lib/netsoul/client.rb +2 -9
- data/lib/netsoul/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b99b928d22287e2b32f8072fdc80c950dd8212f5
|
4
|
+
data.tar.gz: e8f00b15db4357d483e8a31d2a23876bd9ae0558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee9895ef54494577f0245efb436ef9bc430110898f7f6ecf8a3b53ddb3a7063beeb2ee4052234933002602f4c52c7cd2811e02dff20a410d5628520a869c170
|
7
|
+
data.tar.gz: 07fc1f812a9c2655ad1fb052da3d27b58bbeb5615b98f0f20d9deb6da9ff4958d4e175dd9ae5b8d2864899971dda484a974773d3d54bfb64b7381722e8258efe
|
data/bin/netsoul-ruby
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
lib = File.
|
6
|
-
$LOAD_PATH.unshift
|
5
|
+
lib = File.join(File.dirname(File.realpath(__FILE__)), '..', 'lib')
|
6
|
+
$LOAD_PATH.unshift File.expand_path(lib)
|
7
7
|
|
8
8
|
require 'netsoul/client'
|
9
9
|
|
@@ -37,6 +37,15 @@ if options.empty? || options[:user_opts].size == 0
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def trap_interrupt(client)
|
41
|
+
Signal.trap('INT'.freeze) do
|
42
|
+
exit 42 unless client.started
|
43
|
+
begin client.disconnect; end
|
44
|
+
puts '!!! [SIGINT] !!!'.freeze
|
45
|
+
exit 42
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
40
49
|
retry_count = 10
|
41
50
|
retry_wait_time = 1.0
|
42
51
|
RETRY_WAIT_FACTOR = 2.0 # Each time retry is called in Exception block, current 'retry_wait_time' is increased with this factor
|
@@ -44,6 +53,7 @@ begin
|
|
44
53
|
c = Netsoul::Client.new options[:user_opts]
|
45
54
|
c.connect
|
46
55
|
if c.started
|
56
|
+
trap_interrupt c
|
47
57
|
retry_count = 10
|
48
58
|
retry_wait_time = 1.0
|
49
59
|
loop do
|
@@ -52,10 +62,6 @@ begin
|
|
52
62
|
sleep 1
|
53
63
|
end
|
54
64
|
end
|
55
|
-
rescue Interrupt
|
56
|
-
begin c.disconnect; end
|
57
|
-
puts '!!! [SIGINT] !!!'.freeze
|
58
|
-
exit 42
|
59
65
|
rescue => e
|
60
66
|
puts "[ERROR]: #{e}"
|
61
67
|
puts "[RETRY_COUNT]: #{retry_count}"
|
data/lib/netsoul/client.rb
CHANGED
@@ -68,9 +68,6 @@ module Netsoul
|
|
68
68
|
s.flush
|
69
69
|
end
|
70
70
|
log :info, "[send] #{str.chomp}"
|
71
|
-
rescue Errno::EPIPE
|
72
|
-
disconnect
|
73
|
-
connect
|
74
71
|
end
|
75
72
|
|
76
73
|
def get
|
@@ -83,16 +80,12 @@ module Netsoul
|
|
83
80
|
else
|
84
81
|
'nothing'.freeze # Send some string and permit IO.select to thrown exception if something goes wrong.
|
85
82
|
end
|
86
|
-
rescue Errno::EPIPE
|
87
|
-
disconnect
|
88
|
-
connect
|
89
83
|
end
|
90
84
|
|
91
85
|
def close
|
92
|
-
@started = false
|
93
86
|
@socket.close
|
94
|
-
|
95
|
-
|
87
|
+
ensure
|
88
|
+
@started = false
|
96
89
|
end
|
97
90
|
end
|
98
91
|
end
|
data/lib/netsoul/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsoul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Kakesa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|