iproto 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
data/iproto.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'iproto'
7
- s.version = '0.3.12'
7
+ s.version = '0.3.13'
8
8
  s.date = '2014-01-15'
9
9
  s.rubyforge_project = 'iproto'
10
10
 
@@ -26,7 +26,7 @@ module IProto
26
26
 
27
27
  def could_be_connected?
28
28
  @socket ? @socket != :disconnected
29
- : (@retry || @reconnect_time < Time.now)
29
+ : (@reconnect || @reconnect_time < Time.now)
30
30
  end
31
31
 
32
32
  def socket
@@ -38,7 +38,11 @@ module IProto
38
38
  end
39
39
  sock
40
40
  rescue Errno::ECONNREFUSED => e
41
- @socket = :disconnected unless @reconnect
41
+ unless @reconnect
42
+ @socket = :disconnected
43
+ else
44
+ @reconnect_time = Time.now + @reconnect_timeout
45
+ end
42
46
  raise CouldNotConnect, e
43
47
  end
44
48
 
@@ -46,6 +50,9 @@ module IProto
46
50
 
47
51
  # begin ConnectionAPI
48
52
  def send_request(request_type, body)
53
+ unless could_be_connected?
54
+ raise Disconnected, "connection is closed"
55
+ end
49
56
  begin
50
57
  request_id = next_request_id
51
58
  socket.send pack_request(request_type, request_id, body), 0
data/lib/iproto.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IProto
2
- VERSION = '0.3.12'
2
+ VERSION = '0.3.13'
3
3
  class IProtoError < StandardError; end
4
4
  class ConnectionError < IProtoError; end
5
5
  class CouldNotConnect < ConnectionError; end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: iproto
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.12
5
+ version: 0.3.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Rudenko