netsoul 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netsoul/client.rb +12 -4
- 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: df5f49b5d93542894a251ef2248ba334de6cde11
|
4
|
+
data.tar.gz: 8a18fb5d6f52f2dbdbc530456bdff7f01847c88b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d2f2520b964365da14ff85742fdc3e0eab0e2964c7c23081d0cc9636b7824e5437706c6179555aff9852badac7dc64c235d44e8303301afea340e3314e4c074
|
7
|
+
data.tar.gz: f68d3a70e5153fd6eaeca3ce414c7ce0e60d6bfdbf8ebb6f6ea5519c4c04dcfe43f3dff25e075512fad05250d3b753c4e18a7f3bc0c8bcb8a10e34bd8e2926fb
|
data/lib/netsoul/client.rb
CHANGED
@@ -6,7 +6,7 @@ module Netsoul
|
|
6
6
|
include Logging
|
7
7
|
attr_reader :started
|
8
8
|
SOCKET_READ_TIMEOUT = 12 * 60
|
9
|
-
SOCKET_WRITE_TIMEOUT =
|
9
|
+
SOCKET_WRITE_TIMEOUT = 1 * 60
|
10
10
|
|
11
11
|
def initialize(*args)
|
12
12
|
opts = args.last.is_a?(Hash) ? args.last : {}
|
@@ -59,7 +59,11 @@ module Netsoul
|
|
59
59
|
def send(str)
|
60
60
|
_, sock = IO.select(nil, [@socket], nil, SOCKET_WRITE_TIMEOUT)
|
61
61
|
fail Netsoul::SocketError, 'Timeout or fail on write socket' if sock.nil? || sock.empty?
|
62
|
-
sock.first
|
62
|
+
s = sock.first
|
63
|
+
if s
|
64
|
+
s.puts str
|
65
|
+
s.flush
|
66
|
+
end
|
63
67
|
log :info, "[send] #{str.chomp}"
|
64
68
|
end
|
65
69
|
|
@@ -67,8 +71,12 @@ module Netsoul
|
|
67
71
|
sock, = IO.select([@socket], nil, nil, SOCKET_READ_TIMEOUT)
|
68
72
|
fail Netsoul::SocketError, 'Timeout or fail on read socket' if sock.nil? || sock.empty?
|
69
73
|
res = sock.first.gets
|
70
|
-
|
71
|
-
|
74
|
+
if res
|
75
|
+
log :info, "[get ] #{res.chomp}"
|
76
|
+
res
|
77
|
+
else
|
78
|
+
'nothing' # Send some string and permit IO.select to thrown exception if something goes wrong.
|
79
|
+
end
|
72
80
|
end
|
73
81
|
|
74
82
|
def close
|
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.2.
|
4
|
+
version: 2.2.1
|
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-01-
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|