iproto 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
data/iproto.gemspec CHANGED
@@ -4,8 +4,8 @@ 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.11'
8
- s.date = '2013-12-10'
7
+ s.version = '0.3.12'
8
+ s.date = '2014-01-15'
9
9
  s.rubyforge_project = 'iproto'
10
10
 
11
11
  s.summary = "Mail.Ru simple network protocol"
@@ -70,10 +70,11 @@ module IProto
70
70
  end
71
71
 
72
72
  def recv_response(response_size)
73
- socket.read(response_size) or _raise_disconnected('disconnected while read', 2)
73
+ socket.read(response_size) or _raise_disconnected('disconnected while read', true)
74
74
  end
75
75
 
76
76
  def _raise_disconnected(message, _raise = true)
77
+ old_socket = @socket
77
78
  if @reconnect
78
79
  @socket = nil
79
80
  @reconnect_time = Time.now + @reconnect_timeout
@@ -84,7 +85,16 @@ module IProto
84
85
  when true
85
86
  raise Disconnected, message
86
87
  when :retry
87
- raise Retry
88
+ begin
89
+ # if request were sent, then we will not have EPIPE exception
90
+ old_socket.send '\x00', 0
91
+ rescue Errno::EPIPE
92
+ # OS knows that socket is closed, and request were not sent
93
+ raise Retry
94
+ else
95
+ # OS didn't notice socket is closed, request were sent probably
96
+ raise Disconnected, message
97
+ end
88
98
  end
89
99
  end
90
100
  end
data/lib/iproto.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IProto
2
- VERSION = '0.3.11'
2
+ VERSION = '0.3.12'
3
3
  class IProtoError < StandardError; end
4
4
  class ConnectionError < IProtoError; end
5
5
  class CouldNotConnect < ConnectionError; end
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iproto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
5
4
  prerelease:
5
+ version: 0.3.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Rudenko
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-10 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
16
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
17
18
  requirements:
18
19
  - - ~>
19
20
  - !ruby/object:Gem::Version
20
21
  version: 0.0.3
21
- none: false
22
+ prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
24
+ none: false
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
26
28
  version: 0.0.3
27
- none: false
28
- prerelease: false
29
29
  name: bin_utils
30
30
  description: Mail.Ru simple network protocol
31
31
  email: ceo@prepor.ru
@@ -53,20 +53,20 @@ rdoc_options:
53
53
  require_paths:
54
54
  - lib
55
55
  required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
56
57
  requirements:
57
58
  - - ! '>='
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
- none: false
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
62
63
  requirements:
63
64
  - - ! '>='
64
65
  - !ruby/object:Gem::Version
65
66
  version: '0'
66
- none: false
67
67
  requirements: []
68
68
  rubyforge_project: iproto
69
- rubygems_version: 1.8.25
69
+ rubygems_version: 1.8.23
70
70
  signing_key:
71
71
  specification_version: 2
72
72
  summary: Mail.Ru simple network protocol