ffi-rzmq 0.9.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -14,3 +14,4 @@ matrix:
14
14
  allow_failures:
15
15
  - rvm: ruby-head
16
16
  - rvm: jruby-head
17
+ - rvm: 1.9.2
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 1.0.0 / 20130109
2
+ * Fix for issue #74 (send_multiple improperly handled single part messages).
3
+
4
+ * Fix for issue #77 (unbind and disconnect).
5
+
6
+ * Fix for issue #75 (socket monitor events).
7
+
8
+ * The API is stable. Releasing 1.0.
9
+
1
10
  == 0.9.7 / 20121221
2
11
  * BROKE THE API.
3
12
  ZMQ::Poller#register and ZMQ::Poller#deregister don't take fd argument
data/lib/ffi-rzmq.rb CHANGED
@@ -8,7 +8,7 @@ module ZMQ
8
8
  # Returns the version string for the library.
9
9
  #
10
10
  def self.version
11
- @version ||= File.read(path('version.txt')).strip
11
+ @version ||= ZMQ::VERSION
12
12
  end
13
13
 
14
14
  # Returns the library path for the module. If any arguments are given,
@@ -176,6 +176,10 @@ if ZMQ::LibZMQ.version3?
176
176
  EVENT_CLOSED = 128
177
177
  EVENT_CLOSE_FAILED = 256
178
178
  EVENT_DISCONNECTED = 512
179
+ EVENT_ALL = EVENT_CONNECTED | EVENT_CONNECT_DELAYED | EVENT_CONNECT_RETRIED |
180
+ EVENT_LISTENING | EVENT_BIND_FAILED | EVENT_ACCEPTED |
181
+ EVENT_ACCEPT_FAILED | EVENT_CLOSED | EVENT_CLOSE_FAILED |
182
+ EVENT_DISCONNECTED
179
183
 
180
184
  # Socket & other errors
181
185
  EMFILE = Errno::EMFILE::Errno
@@ -244,7 +244,8 @@ module ZMQ
244
244
  module EventDataLayout
245
245
  def self.included(base)
246
246
  base.class_eval do
247
- layout :addr, :string,
247
+ layout :event, :int,
248
+ :addr, :string,
248
249
  :field2, :int
249
250
  end
250
251
  end
@@ -253,6 +254,8 @@ module ZMQ
253
254
  class EventData < FFI::Struct
254
255
  include EventDataLayout
255
256
 
257
+ def event() self[:event]; end
258
+
256
259
  def addr() self[:addr]; end
257
260
  alias :address :addr
258
261
 
@@ -261,7 +264,7 @@ module ZMQ
261
264
  alias :interval :fd
262
265
 
263
266
  def inspect
264
- "addr [#{addr}], fd [#{fd}], field2 [#{fd}]"
267
+ "event [#{event}], addr [#{addr}], fd [#{fd}], field2 [#{fd}]"
265
268
  end
266
269
 
267
270
  def to_s; inspect; end
@@ -434,7 +434,7 @@ module ZMQ
434
434
  -1
435
435
  else
436
436
  flags = NonBlocking if dontwait?(flags)
437
- rc = nil
437
+ rc = 0
438
438
 
439
439
  parts[0..-2].each do |part|
440
440
  rc = send(method_name, part, (flags | ZMQ::SNDMORE))
@@ -637,7 +637,9 @@ module ZMQ
637
637
  end
638
638
 
639
639
  def self.close socket
640
- Proc.new { LibZMQ.zmq_close socket }
640
+ Proc.new do
641
+ LibZMQ.zmq_close(socket) if socket && !socket.null?
642
+ end
641
643
  end
642
644
  end # class Socket for version2
643
645
 
@@ -1,3 +1,3 @@
1
1
  module ZMQ
2
- VERSION = "0.9.7"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -5,6 +5,34 @@ module ZMQ
5
5
  context "multipart messages" do
6
6
  before(:all) { @ctx = Context.new }
7
7
  after(:all) { @ctx.terminate }
8
+
9
+ context "using #send_strings" do
10
+ include APIHelper
11
+
12
+ before(:all) do
13
+ @receiver = Socket.new(@ctx.pointer, ZMQ::REP)
14
+ port = bind_to_random_tcp_port(@receiver)
15
+
16
+ @sender = Socket.new(@ctx.pointer, ZMQ::REQ)
17
+ rc = @sender.connect("tcp://127.0.0.1:#{port}")
18
+ end
19
+
20
+ after(:all) do
21
+ @sender.close
22
+ @receiver.close
23
+ end
24
+
25
+ it "correctly handles a multipart message array with 1 element" do
26
+ data = [ "1" ]
27
+
28
+ @sender.send_strings(data)
29
+ sleep 1
30
+ strings = []
31
+ rc = @receiver.recv_strings(strings)
32
+ strings.should == data
33
+ end
34
+ end
35
+
8
36
 
9
37
  context "without identity" do
10
38
  include APIHelper
data/spec/socket_spec.rb CHANGED
@@ -477,7 +477,7 @@ module ZMQ
477
477
  array = []
478
478
  rc = socket.getsockopt(ZMQ::FD, array)
479
479
  rc.should == 0
480
- array[0].should be_a(Fixnum)
480
+ array[0].should > 0
481
481
  end
482
482
 
483
483
  it "returns a valid FD that is accepted by the system poll() function" do
metadata CHANGED
@@ -1,64 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-rzmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
5
4
  prerelease:
5
+ version: 1.0.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chuck Remes
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: ffi
15
+ prerelease: false
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
18
  - - ! '>='
20
19
  - !ruby/object:Gem::Version
21
20
  version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
21
  none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
27
+ none: false
28
+ name: ffi
29
+ type: :runtime
30
30
  - !ruby/object:Gem::Dependency
31
- name: rspec
31
+ prerelease: false
32
32
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
33
  requirements:
35
34
  - - ~>
36
35
  - !ruby/object:Gem::Version
37
36
  version: '2.6'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
37
  none: false
38
+ version_requirements: !ruby/object:Gem::Requirement
42
39
  requirements:
43
40
  - - ~>
44
41
  - !ruby/object:Gem::Version
45
42
  version: '2.6'
43
+ none: false
44
+ name: rspec
45
+ type: :development
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake
47
+ prerelease: false
48
48
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
49
  requirements:
51
50
  - - ! '>='
52
51
  - !ruby/object:Gem::Version
53
52
  version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
53
  none: false
54
+ version_requirements: !ruby/object:Gem::Requirement
58
55
  requirements:
59
56
  - - ! '>='
60
57
  - !ruby/object:Gem::Version
61
58
  version: '0'
59
+ none: false
60
+ name: rake
61
+ type: :development
62
62
  description: ! 'This gem wraps the ZeroMQ networking library using the ruby FFI (foreign
63
63
 
64
64
  function interface). It''s a pure ruby wrapper so this gem can be loaded
@@ -72,70 +72,134 @@ executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
- - .bnsignore
76
- - .gitignore
77
- - .travis.yml
78
- - AUTHORS.txt
79
- - Gemfile
80
- - History.txt
81
- - README.rdoc
82
- - Rakefile
83
- - examples/README.rdoc
84
- - examples/v2api/latency_measurement.rb
85
- - examples/v2api/local_lat.rb
86
- - examples/v2api/local_lat_poll.rb
87
- - examples/v2api/local_throughput.rb
88
- - examples/v2api/pub.rb
89
- - examples/v2api/publish_subscribe.rb
90
- - examples/v2api/remote_lat.rb
91
- - examples/v2api/remote_throughput.rb
92
- - examples/v2api/reqrep_poll.rb
93
- - examples/v2api/request_response.rb
94
- - examples/v2api/sub.rb
95
- - examples/v2api/throughput_measurement.rb
96
- - examples/v2api/xreqxrep_poll.rb
97
- - examples/v3api/latency_measurement.rb
98
- - examples/v3api/local_lat.rb
99
- - examples/v3api/local_lat_poll.rb
100
- - examples/v3api/local_throughput.rb
101
- - examples/v3api/pub.rb
102
- - examples/v3api/publish_subscribe.rb
103
- - examples/v3api/remote_lat.rb
104
- - examples/v3api/remote_throughput.rb
105
- - examples/v3api/reqrep_poll.rb
106
- - examples/v3api/request_response.rb
107
- - examples/v3api/sub.rb
108
- - examples/v3api/throughput_measurement.rb
109
- - examples/v3api/xreqxrep_poll.rb
110
- - ext/README
111
- - ffi-rzmq.gemspec
112
- - lib/ffi-rzmq.rb
113
- - lib/ffi-rzmq/constants.rb
114
- - lib/ffi-rzmq/context.rb
115
- - lib/ffi-rzmq/device.rb
116
- - lib/ffi-rzmq/exceptions.rb
117
- - lib/ffi-rzmq/libc.rb
118
- - lib/ffi-rzmq/libzmq.rb
119
- - lib/ffi-rzmq/message.rb
120
- - lib/ffi-rzmq/poll.rb
121
- - lib/ffi-rzmq/poll_item.rb
122
- - lib/ffi-rzmq/poll_items.rb
123
- - lib/ffi-rzmq/socket.rb
124
- - lib/ffi-rzmq/util.rb
125
- - lib/ffi-rzmq/version.rb
126
- - lib/io_extensions.rb
127
- - spec/context_spec.rb
128
- - spec/device_spec.rb
129
- - spec/message_spec.rb
130
- - spec/multipart_spec.rb
131
- - spec/nonblocking_recv_spec.rb
132
- - spec/poll_spec.rb
133
- - spec/pushpull_spec.rb
134
- - spec/reqrep_spec.rb
135
- - spec/socket_spec.rb
136
- - spec/spec_helper.rb
137
- - spec/support/test.crt
138
- - spec/support/test.key
75
+ - !binary |-
76
+ LmJuc2lnbm9yZQ==
77
+ - !binary |-
78
+ LmdpdGlnbm9yZQ==
79
+ - !binary |-
80
+ LnRyYXZpcy55bWw=
81
+ - !binary |-
82
+ QVVUSE9SUy50eHQ=
83
+ - !binary |-
84
+ R2VtZmlsZQ==
85
+ - !binary |-
86
+ SGlzdG9yeS50eHQ=
87
+ - !binary |-
88
+ UkVBRE1FLnJkb2M=
89
+ - !binary |-
90
+ UmFrZWZpbGU=
91
+ - !binary |-
92
+ ZXhhbXBsZXMvUkVBRE1FLnJkb2M=
93
+ - !binary |-
94
+ ZXhhbXBsZXMvdjJhcGkvbGF0ZW5jeV9tZWFzdXJlbWVudC5yYg==
95
+ - !binary |-
96
+ ZXhhbXBsZXMvdjJhcGkvbG9jYWxfbGF0LnJi
97
+ - !binary |-
98
+ ZXhhbXBsZXMvdjJhcGkvbG9jYWxfbGF0X3BvbGwucmI=
99
+ - !binary |-
100
+ ZXhhbXBsZXMvdjJhcGkvbG9jYWxfdGhyb3VnaHB1dC5yYg==
101
+ - !binary |-
102
+ ZXhhbXBsZXMvdjJhcGkvcHViLnJi
103
+ - !binary |-
104
+ ZXhhbXBsZXMvdjJhcGkvcHVibGlzaF9zdWJzY3JpYmUucmI=
105
+ - !binary |-
106
+ ZXhhbXBsZXMvdjJhcGkvcmVtb3RlX2xhdC5yYg==
107
+ - !binary |-
108
+ ZXhhbXBsZXMvdjJhcGkvcmVtb3RlX3Rocm91Z2hwdXQucmI=
109
+ - !binary |-
110
+ ZXhhbXBsZXMvdjJhcGkvcmVxcmVwX3BvbGwucmI=
111
+ - !binary |-
112
+ ZXhhbXBsZXMvdjJhcGkvcmVxdWVzdF9yZXNwb25zZS5yYg==
113
+ - !binary |-
114
+ ZXhhbXBsZXMvdjJhcGkvc3ViLnJi
115
+ - !binary |-
116
+ ZXhhbXBsZXMvdjJhcGkvdGhyb3VnaHB1dF9tZWFzdXJlbWVudC5yYg==
117
+ - !binary |-
118
+ ZXhhbXBsZXMvdjJhcGkveHJlcXhyZXBfcG9sbC5yYg==
119
+ - !binary |-
120
+ ZXhhbXBsZXMvdjNhcGkvbGF0ZW5jeV9tZWFzdXJlbWVudC5yYg==
121
+ - !binary |-
122
+ ZXhhbXBsZXMvdjNhcGkvbG9jYWxfbGF0LnJi
123
+ - !binary |-
124
+ ZXhhbXBsZXMvdjNhcGkvbG9jYWxfbGF0X3BvbGwucmI=
125
+ - !binary |-
126
+ ZXhhbXBsZXMvdjNhcGkvbG9jYWxfdGhyb3VnaHB1dC5yYg==
127
+ - !binary |-
128
+ ZXhhbXBsZXMvdjNhcGkvcHViLnJi
129
+ - !binary |-
130
+ ZXhhbXBsZXMvdjNhcGkvcHVibGlzaF9zdWJzY3JpYmUucmI=
131
+ - !binary |-
132
+ ZXhhbXBsZXMvdjNhcGkvcmVtb3RlX2xhdC5yYg==
133
+ - !binary |-
134
+ ZXhhbXBsZXMvdjNhcGkvcmVtb3RlX3Rocm91Z2hwdXQucmI=
135
+ - !binary |-
136
+ ZXhhbXBsZXMvdjNhcGkvcmVxcmVwX3BvbGwucmI=
137
+ - !binary |-
138
+ ZXhhbXBsZXMvdjNhcGkvcmVxdWVzdF9yZXNwb25zZS5yYg==
139
+ - !binary |-
140
+ ZXhhbXBsZXMvdjNhcGkvc3ViLnJi
141
+ - !binary |-
142
+ ZXhhbXBsZXMvdjNhcGkvdGhyb3VnaHB1dF9tZWFzdXJlbWVudC5yYg==
143
+ - !binary |-
144
+ ZXhhbXBsZXMvdjNhcGkveHJlcXhyZXBfcG9sbC5yYg==
145
+ - !binary |-
146
+ ZXh0L1JFQURNRQ==
147
+ - !binary |-
148
+ ZmZpLXJ6bXEuZ2Vtc3BlYw==
149
+ - !binary |-
150
+ bGliL2ZmaS1yem1xLnJi
151
+ - !binary |-
152
+ bGliL2ZmaS1yem1xL2NvbnN0YW50cy5yYg==
153
+ - !binary |-
154
+ bGliL2ZmaS1yem1xL2NvbnRleHQucmI=
155
+ - !binary |-
156
+ bGliL2ZmaS1yem1xL2RldmljZS5yYg==
157
+ - !binary |-
158
+ bGliL2ZmaS1yem1xL2V4Y2VwdGlvbnMucmI=
159
+ - !binary |-
160
+ bGliL2ZmaS1yem1xL2xpYmMucmI=
161
+ - !binary |-
162
+ bGliL2ZmaS1yem1xL2xpYnptcS5yYg==
163
+ - !binary |-
164
+ bGliL2ZmaS1yem1xL21lc3NhZ2UucmI=
165
+ - !binary |-
166
+ bGliL2ZmaS1yem1xL3BvbGwucmI=
167
+ - !binary |-
168
+ bGliL2ZmaS1yem1xL3BvbGxfaXRlbS5yYg==
169
+ - !binary |-
170
+ bGliL2ZmaS1yem1xL3BvbGxfaXRlbXMucmI=
171
+ - !binary |-
172
+ bGliL2ZmaS1yem1xL3NvY2tldC5yYg==
173
+ - !binary |-
174
+ bGliL2ZmaS1yem1xL3V0aWwucmI=
175
+ - !binary |-
176
+ bGliL2ZmaS1yem1xL3ZlcnNpb24ucmI=
177
+ - !binary |-
178
+ bGliL2lvX2V4dGVuc2lvbnMucmI=
179
+ - !binary |-
180
+ c3BlYy9jb250ZXh0X3NwZWMucmI=
181
+ - !binary |-
182
+ c3BlYy9kZXZpY2Vfc3BlYy5yYg==
183
+ - !binary |-
184
+ c3BlYy9tZXNzYWdlX3NwZWMucmI=
185
+ - !binary |-
186
+ c3BlYy9tdWx0aXBhcnRfc3BlYy5yYg==
187
+ - !binary |-
188
+ c3BlYy9ub25ibG9ja2luZ19yZWN2X3NwZWMucmI=
189
+ - !binary |-
190
+ c3BlYy9wb2xsX3NwZWMucmI=
191
+ - !binary |-
192
+ c3BlYy9wdXNocHVsbF9zcGVjLnJi
193
+ - !binary |-
194
+ c3BlYy9yZXFyZXBfc3BlYy5yYg==
195
+ - !binary |-
196
+ c3BlYy9zb2NrZXRfc3BlYy5yYg==
197
+ - !binary |-
198
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
199
+ - !binary |-
200
+ c3BlYy9zdXBwb3J0L3Rlc3QuY3J0
201
+ - !binary |-
202
+ c3BlYy9zdXBwb3J0L3Rlc3Qua2V5
139
203
  homepage: http://github.com/chuckremes/ffi-rzmq
140
204
  licenses: []
141
205
  post_install_message:
@@ -143,17 +207,17 @@ rdoc_options: []
143
207
  require_paths:
144
208
  - lib
145
209
  required_ruby_version: !ruby/object:Gem::Requirement
146
- none: false
147
210
  requirements:
148
211
  - - ! '>='
149
212
  - !ruby/object:Gem::Version
150
213
  version: '0'
151
- required_rubygems_version: !ruby/object:Gem::Requirement
152
214
  none: false
215
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
216
  requirements:
154
217
  - - ! '>='
155
218
  - !ruby/object:Gem::Version
156
219
  version: '0'
220
+ none: false
157
221
  requirements: []
158
222
  rubyforge_project: ffi-rzmq
159
223
  rubygems_version: 1.8.24
@@ -162,15 +226,27 @@ specification_version: 3
162
226
  summary: This gem wraps the ZeroMQ (0mq) networking library using Ruby FFI (foreign
163
227
  function interface).
164
228
  test_files:
165
- - spec/context_spec.rb
166
- - spec/device_spec.rb
167
- - spec/message_spec.rb
168
- - spec/multipart_spec.rb
169
- - spec/nonblocking_recv_spec.rb
170
- - spec/poll_spec.rb
171
- - spec/pushpull_spec.rb
172
- - spec/reqrep_spec.rb
173
- - spec/socket_spec.rb
174
- - spec/spec_helper.rb
175
- - spec/support/test.crt
176
- - spec/support/test.key
229
+ - !binary |-
230
+ c3BlYy9jb250ZXh0X3NwZWMucmI=
231
+ - !binary |-
232
+ c3BlYy9kZXZpY2Vfc3BlYy5yYg==
233
+ - !binary |-
234
+ c3BlYy9tZXNzYWdlX3NwZWMucmI=
235
+ - !binary |-
236
+ c3BlYy9tdWx0aXBhcnRfc3BlYy5yYg==
237
+ - !binary |-
238
+ c3BlYy9ub25ibG9ja2luZ19yZWN2X3NwZWMucmI=
239
+ - !binary |-
240
+ c3BlYy9wb2xsX3NwZWMucmI=
241
+ - !binary |-
242
+ c3BlYy9wdXNocHVsbF9zcGVjLnJi
243
+ - !binary |-
244
+ c3BlYy9yZXFyZXBfc3BlYy5yYg==
245
+ - !binary |-
246
+ c3BlYy9zb2NrZXRfc3BlYy5yYg==
247
+ - !binary |-
248
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
249
+ - !binary |-
250
+ c3BlYy9zdXBwb3J0L3Rlc3QuY3J0
251
+ - !binary |-
252
+ c3BlYy9zdXBwb3J0L3Rlc3Qua2V5