iproto 0.3.15 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTI0M2I4ODY4NDA1OWI3MmJjNjBkYzhkZWY3MTJlMjVlYzFiNTYxMw==
5
+ data.tar.gz: !binary |-
6
+ YWEyNDM1ZGYwY2ExMjU1MWEzMWVmMjJhMDczNjAxYjFmNGViNjI0Yg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjUxZWRhZjRkNjhmMzE3ODI3OGJmNTMxYTE4OGNkZmRlYzU1ZDVjMmY3MmYx
10
+ NjUzNTYyNTliY2ViMWI1YWJhYjI4N2FjMDg3OGY0Njg5NWU1MGIyYTE3Yzlm
11
+ MTlmODIxYWQwYmE5NDFkNzZjODE5MmUxMjBlZTNiZmQyYWQ4NmQ=
12
+ data.tar.gz: !binary |-
13
+ ZTRkOTI1MzI3MzUzNjZjNmRjMzYwNGUyMjJlYmYzOWI4ZTFkNjQ2YmExNjYy
14
+ MmEyNTQ4NWJhMTQyMmQwNWEwYTVlNTIxOTA3N2EyZTJiNDBhYzVkNDNmNjhm
15
+ Mjg0NzVmNTY1MTcwMTc2ODY3ZmNiOWU0MTQyZmFlZjgyMzJmY2Q=
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.15'
8
- s.date = '2014-10-27'
7
+ s.version = '0.3.16'
8
+ s.date = '2014-10-28'
9
9
  s.rubyforge_project = 'iproto'
10
10
 
11
11
  s.summary = "Mail.Ru simple network protocol"
data/lib/iproto.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module IProto
2
- VERSION = '0.3.15'
2
+ VERSION = '0.3.16'
3
3
  class IProtoError < StandardError; end
4
4
  class ConnectionError < IProtoError; end
5
5
  class CouldNotConnect < ConnectionError; end
data/lib/iproto/em.rb CHANGED
@@ -53,24 +53,17 @@ module IProto
53
53
  shutdown_hook
54
54
  end
55
55
 
56
- def _start_pinger
57
- if @connected == true && (cit = comm_inactivity_timeout) != 0 && @ping_timer == nil
58
- @ping_timer = EM.add_periodic_timer([1, cit / 4.0].min, method(:_ping))
59
- end
60
- end
61
-
62
56
  def _stop_pinger
63
57
  if @ping_timer
64
- @ping_timer.cancel
58
+ EM.cancel_timer @ping_timer
65
59
  @ping_timer = nil
66
60
  end
67
61
  end
68
62
 
69
63
  def comm_inactivity_timeout=(t)
70
- _stop_pinger
71
64
  @inactivity_timeout = t
72
65
  super
73
- _start_pinger
66
+ _ping
74
67
  end
75
68
 
76
69
  def connected?
@@ -112,6 +105,7 @@ module IProto
112
105
 
113
106
  def _ping
114
107
  send_data pack_request(PING, PING_ID, EMPTY_STR)
108
+ @ping_timer = nil
115
109
  end
116
110
 
117
111
  def receive_chunk(chunk)
@@ -129,6 +123,9 @@ module IProto
129
123
  if @request_id == PING_ID
130
124
  @_needed_size = HEADER_SIZE
131
125
  @_state = :receive_header
126
+ if @ping_timer == nil && @inactivity_timeout > 0
127
+ @ping_timer = ::EM.add_timer(@inactivity_timeout / 4.0, method(:_ping))
128
+ end
132
129
  return
133
130
  end
134
131
  request = @waiting_requests.delete @request_id
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iproto
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.3.15
4
+ version: 0.3.16
6
5
  platform: ruby
7
6
  authors:
8
7
  - Andrew Rudenko
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- type: :runtime
14
+ prerelease: false
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.0.3
22
- prerelease: false
20
+ type: :runtime
21
+ name: bin_utils
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
- none: false
25
23
  requirements:
26
24
  - - ~>
27
25
  - !ruby/object:Gem::Version
28
26
  version: 0.0.3
29
- name: bin_utils
30
27
  description: Mail.Ru simple network protocol
31
28
  email: ceo@prepor.ru
32
29
  executables: []
@@ -47,26 +44,25 @@ files:
47
44
  homepage: http://github.com/mailru/iproto-ruby
48
45
  licenses:
49
46
  - BSD-2-Clause
47
+ metadata: {}
50
48
  post_install_message:
51
49
  rdoc_options:
52
50
  - --charset=UTF-8
53
51
  require_paths:
54
52
  - lib
55
53
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
55
  - - ! '>='
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0'
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
60
  - - ! '>='
65
61
  - !ruby/object:Gem::Version
66
62
  version: '0'
67
63
  requirements: []
68
64
  rubyforge_project: iproto
69
- rubygems_version: 1.8.23
65
+ rubygems_version: 2.4.2
70
66
  signing_key:
71
67
  specification_version: 2
72
68
  summary: Mail.Ru simple network protocol