em-zmq-tp10 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,15 +20,33 @@ module EventMachine
20
20
  class PreDealer < Socket
21
21
  # @private
22
22
  def choose_peer(even_if_busy = false)
23
- peers = even_if_busy ? @peers : @free_peers
23
+ if even_if_busy
24
+ peers = @peers
25
+ all_peers = nil
26
+ else
27
+ peers = @free_peers
28
+ all_peers = @peers
29
+ end
30
+
24
31
  i = peers.size
25
32
  while i > 0
26
- ident, connect = peers.shift
27
- if even_if_busy || connect.not_too_busy?
28
- peers[ident] = connect # use the fact, that hash is ordered in Ruby 1.9
29
- return connect unless connect.error?
33
+ while i > 0
34
+ ident, connect = peers.shift
35
+ if all_peers
36
+ all_peers.delete(ident)
37
+ all_peers[ident] = connect
38
+ else
39
+ peers[ident] = connect
40
+ end
41
+ if even_if_busy || connect.not_too_busy?
42
+ @free_peers[ident] = connect # use the fact, that hash is ordered in Ruby 1.9
43
+ return connect unless connect.error?
44
+ end
45
+ i -= 1
30
46
  end
31
- i -= 1
47
+ i = all_peers ? all_peers.size - peers.size : 0
48
+ peers = all_peers
49
+ all_peers = nil
32
50
  end
33
51
  end
34
52
 
@@ -308,7 +308,7 @@ module EventMachine
308
308
  callback ||= block
309
309
  if Proc === callback
310
310
  deferrable.callback(&callback)
311
- else
311
+ elsif callback
312
312
  deferrable.callback{|reply, _data| callback.call(reply, _data)}
313
313
  end
314
314
  if request_id = super(message, wrapped)
@@ -1,7 +1,7 @@
1
1
  module EventMachine
2
2
  module Protocols
3
3
  module Zmq2
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.15'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,25 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-zmq-tp10
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
5
4
  prerelease:
5
+ version: 0.1.15
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sokolov Yura 'funny-falcon'
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-14 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: eventmachine
15
+ type: :runtime
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
- type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  none: false
@@ -27,15 +26,15 @@ dependencies:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
29
+ name: eventmachine
30
30
  - !ruby/object:Gem::Dependency
31
- name: ffi-rzmq
31
+ type: :development
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
- type: :development
39
38
  prerelease: false
40
39
  version_requirements: !ruby/object:Gem::Requirement
41
40
  none: false
@@ -43,6 +42,7 @@ dependencies:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
45
+ name: ffi-rzmq
46
46
  description: Implementation of ZMQ2.x transport protocol - ZMTP1.0
47
47
  email:
48
48
  - funny.falcon@gmail.com