ffi-rzmq 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/examples/reqrep_poll.rb +1 -1
- data/ffi-rzmq.gemspec +1 -1
- data/lib/ffi-rzmq/poll.rb +7 -6
- data/lib/ffi-rzmq/poll_items.rb +4 -1
- data/lib/ffi-rzmq/socket.rb +9 -1
- data/lib/ffi-rzmq/zmq.rb +9 -1
- data/spec/context_spec.rb +6 -4
- data/version.txt +1 -1
- metadata +77 -61
- data/.gitignore +0 -3
data/History.txt
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
== 0.7.2 / 20110224
|
2
|
+
* Several minor refactorings to make the code intent clearer and to allow
|
3
|
+
for better testing. In particular, the error condition checking for
|
4
|
+
a non-blocking send/recv is much clearer.
|
5
|
+
|
1
6
|
== 0.7.1 / 20110130
|
2
7
|
* Fixed 1.9.1 Binary Encoding bug when UTF8 set as default (Thanks schmurfy)
|
3
8
|
* Improved rubinius compat for specs
|
4
9
|
* Improved spec compatibility on linux
|
10
|
+
|
5
11
|
== 0.7.0 / 20101222
|
6
12
|
* Improved performance of calls to Socket#getsockopt. There are usually
|
7
13
|
a lot of calls passing RCVMORE, so we now cache those buffers instead
|
data/examples/reqrep_poll.rb
CHANGED
data/ffi-rzmq.gemspec
CHANGED
data/lib/ffi-rzmq/poll.rb
CHANGED
@@ -65,7 +65,7 @@ module ZMQ
|
|
65
65
|
# Does not raise any exceptions.
|
66
66
|
#
|
67
67
|
def register sock, events = ZMQ::POLLIN | ZMQ::POLLOUT, fd = 0
|
68
|
-
return
|
68
|
+
return false if (sock.nil? && fd.zero?) || events.zero?
|
69
69
|
|
70
70
|
@poll_items_dirty = true
|
71
71
|
item = @items.get(@sockets.index(sock))
|
@@ -74,8 +74,7 @@ module ZMQ
|
|
74
74
|
@sockets << sock
|
75
75
|
item = LibZMQ::PollItem.new
|
76
76
|
|
77
|
-
|
78
|
-
when ZMQ::Socket, Socket
|
77
|
+
if sock.kind_of?(ZMQ::Socket) || sock.kind_of?(Socket)
|
79
78
|
item[:socket] = sock.socket
|
80
79
|
item[:fd] = 0
|
81
80
|
else
|
@@ -134,11 +133,13 @@ module ZMQ
|
|
134
133
|
# Deletes the +sock+ for all subscribed events.
|
135
134
|
#
|
136
135
|
def delete sock
|
136
|
+
removed = false
|
137
|
+
|
137
138
|
if index = @sockets.index(sock)
|
138
|
-
@items.delete_at
|
139
|
-
@sockets.delete sock
|
140
|
-
@raw_to_socket.delete sock.socket
|
139
|
+
removed = @items.delete_at(index) and @sockets.delete(sock) and @raw_to_socket.delete(sock.socket.address)
|
141
140
|
end
|
141
|
+
|
142
|
+
removed
|
142
143
|
end
|
143
144
|
|
144
145
|
def size(); @items.size; end
|
data/lib/ffi-rzmq/poll_items.rb
CHANGED
data/lib/ffi-rzmq/socket.rb
CHANGED
@@ -348,11 +348,19 @@ module ZMQ
|
|
348
348
|
end
|
349
349
|
|
350
350
|
private
|
351
|
+
|
352
|
+
def noblock? flag
|
353
|
+
(NOBLOCK & flag) == NOBLOCK
|
354
|
+
end
|
351
355
|
|
352
356
|
def _recv message, flags = 0
|
353
357
|
result_code = LibZMQ.zmq_recv @socket, message.address, flags
|
354
358
|
|
355
|
-
|
359
|
+
if noblock?(flags)
|
360
|
+
error_check_nonblock(result_code)
|
361
|
+
else
|
362
|
+
error_check(ZMQ_RECV_STR, result_code)
|
363
|
+
end
|
356
364
|
end
|
357
365
|
|
358
366
|
# Calls to ZMQ.getsockopt require us to pass in some pointers. We can cache and save those buffers
|
data/lib/ffi-rzmq/zmq.rb
CHANGED
@@ -158,7 +158,15 @@ module ZMQ
|
|
158
158
|
# send/recv. True only when #errno is EGAIN and +result_code+ is non-zero.
|
159
159
|
#
|
160
160
|
def error_check_nonblock result_code
|
161
|
-
|
161
|
+
if result_code.zero?
|
162
|
+
true
|
163
|
+
else
|
164
|
+
# need to check result_code again because !eagain? could be true
|
165
|
+
# and we need the result_code test to fail again to give the right result
|
166
|
+
# !eagain? is true, result_code is -1 => return false
|
167
|
+
# !eagain? is false, result_code is -1 => return false
|
168
|
+
!eagain? && result_code.zero?
|
169
|
+
end
|
162
170
|
end
|
163
171
|
|
164
172
|
def raise_error source, result_code
|
data/spec/context_spec.rb
CHANGED
@@ -60,10 +60,12 @@ module ZMQ
|
|
60
60
|
|
61
61
|
|
62
62
|
context "when allocating a socket" do
|
63
|
-
it "should return a ZMQ::Socket" do
|
64
|
-
ctx = spec_ctx
|
65
|
-
ctx.socket
|
66
|
-
|
63
|
+
# it "should return a ZMQ::Socket" do
|
64
|
+
# ctx = spec_ctx
|
65
|
+
# sock = ctx.socket ZMQ::REQ
|
66
|
+
# sock.should be_kind_of(ZMQ::Socket)
|
67
|
+
# # need to do something with the socket so it's in a state that can return ETERM
|
68
|
+
# end
|
67
69
|
|
68
70
|
it "should raise a ZMQ::SocketError exception when allocation fails" do
|
69
71
|
ctx = spec_ctx
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
metadata
CHANGED
@@ -1,29 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-rzmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 2
|
10
|
+
version: 0.7.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
|
-
|
13
|
+
- Chuck Remes
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-01-30 00:00:00 -
|
18
|
+
date: 2011-01-30 00:00:00 -06:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: bones
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 3
|
32
|
+
- 5
|
33
|
+
- 4
|
34
|
+
version: 3.5.4
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
27
37
|
description: |-
|
28
38
|
This gem wraps the ZeroMQ networking library using the ruby FFI (foreign
|
29
39
|
function interface). It's a pure ruby wrapper so this gem can be loaded
|
@@ -42,69 +52,75 @@ executables: []
|
|
42
52
|
extensions: []
|
43
53
|
|
44
54
|
extra_rdoc_files:
|
45
|
-
|
46
|
-
|
47
|
-
|
55
|
+
- History.txt
|
56
|
+
- README.rdoc
|
57
|
+
- examples/README.rdoc
|
58
|
+
- version.txt
|
48
59
|
files:
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
- version.txt
|
60
|
+
- .bnsignore
|
61
|
+
- History.txt
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- examples/README.rdoc
|
65
|
+
- examples/local_lat.rb
|
66
|
+
- examples/local_lat_poll.rb
|
67
|
+
- examples/local_lat_zerocopy.rb
|
68
|
+
- examples/local_throughput.rb
|
69
|
+
- examples/publish_subscribe.rb
|
70
|
+
- examples/remote_lat.rb
|
71
|
+
- examples/remote_lat_zerocopy.rb
|
72
|
+
- examples/remote_throughput.rb
|
73
|
+
- examples/reqrep_poll.rb
|
74
|
+
- examples/request_response.rb
|
75
|
+
- ffi-rzmq.gemspec
|
76
|
+
- lib/ffi-rzmq.rb
|
77
|
+
- lib/ffi-rzmq/context.rb
|
78
|
+
- lib/ffi-rzmq/exceptions.rb
|
79
|
+
- lib/ffi-rzmq/message.rb
|
80
|
+
- lib/ffi-rzmq/poll.rb
|
81
|
+
- lib/ffi-rzmq/poll_items.rb
|
82
|
+
- lib/ffi-rzmq/socket.rb
|
83
|
+
- lib/ffi-rzmq/wrapper.rb
|
84
|
+
- lib/ffi-rzmq/zmq.rb
|
85
|
+
- spec/context_spec.rb
|
86
|
+
- spec/message_spec.rb
|
87
|
+
- spec/pushpull_spec.rb
|
88
|
+
- spec/reqrep_spec.rb
|
89
|
+
- spec/socket_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- version.txt
|
82
92
|
has_rdoc: true
|
83
93
|
homepage: http://github.com/chuckremes/ffi-rzmq
|
84
94
|
licenses: []
|
85
95
|
|
86
96
|
post_install_message:
|
87
97
|
rdoc_options:
|
88
|
-
|
89
|
-
|
98
|
+
- --main
|
99
|
+
- README.rdoc
|
90
100
|
require_paths:
|
91
|
-
|
101
|
+
- lib
|
92
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
103
|
none: false
|
94
104
|
requirements:
|
95
|
-
|
96
|
-
|
97
|
-
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
98
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
112
|
none: false
|
100
113
|
requirements:
|
101
|
-
|
102
|
-
|
103
|
-
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
104
120
|
requirements: []
|
105
121
|
|
106
122
|
rubyforge_project: ffi-rzmq
|
107
|
-
rubygems_version: 1.
|
123
|
+
rubygems_version: 1.3.7
|
108
124
|
signing_key:
|
109
125
|
specification_version: 3
|
110
126
|
summary: This gem wraps the ZeroMQ networking library using the ruby FFI (foreign function interface).
|
data/.gitignore
DELETED