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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88a0a161a9944738f89281715de8c4e3dce9f318
4
- data.tar.gz: 1a8d88b1f243b9751ad352cb66968de3cf314838
3
+ metadata.gz: df5f49b5d93542894a251ef2248ba334de6cde11
4
+ data.tar.gz: 8a18fb5d6f52f2dbdbc530456bdff7f01847c88b
5
5
  SHA512:
6
- metadata.gz: 37c27d3a8dd4130f99ebe0a1dc5477a280c551b55954d240b686ed545404c9ce8829333b953ba0c81f04796ba886d0a6386ddafdd97a8f2210c3f7ebea9a20d4
7
- data.tar.gz: 69ec5f5769f65f096c939be3b52d82bfb8c65faee145a198732113f209f86965a55c014ff1bc066ce2483cc75f6e17a0399829cfec1b879ec41c3ff351b4d6d1
6
+ metadata.gz: 5d2f2520b964365da14ff85742fdc3e0eab0e2964c7c23081d0cc9636b7824e5437706c6179555aff9852badac7dc64c235d44e8303301afea340e3314e4c074
7
+ data.tar.gz: f68d3a70e5153fd6eaeca3ce414c7ce0e60d6bfdbf8ebb6f6ea5519c4c04dcfe43f3dff25e075512fad05250d3b753c4e18a7f3bc0c8bcb8a10e34bd8e2926fb
@@ -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 = 10
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.puts str
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
- log :info, "[get ] #{res.chomp}" if res
71
- res || ''
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
@@ -1,3 +1,3 @@
1
1
  module Netsoul
2
- VERSION = '2.2.0'.freeze
2
+ VERSION = '2.2.1'.freeze
3
3
  end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler