ffi-rzmq-core 1.0.6 → 1.0.7
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 +5 -5
- data/.travis.yml +2 -4
- data/History.txt +8 -0
- data/lib/ffi-rzmq-core/libzmq.rb +15 -5
- data/lib/ffi-rzmq-core/libzmq4.rb +5 -0
- data/lib/ffi-rzmq-core/version.rb +1 -1
- data/spec/libzmq_spec.rb +23 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dfb36c8fd3ba8ea7889a686282a1eea04fd42b6b418fb627a59136ebca5e9c60
|
4
|
+
data.tar.gz: 6351eccd6e2ca3e0c91a49e02672bbec65d4d33abd728e368a98abf3d975c9ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61f7bd2e38fe8025d8dd37e81e9872770c8ae367ec03305a5b155c4397503996f696af1f33987329ad2019041ddf17a4a1979df2cb0cb64e5c8bbb3852b8255c
|
7
|
+
data.tar.gz: 48c45585ef08d5a03cf76b3eb0e47cace36aacb686626bee1e2a55173b52c56ae858d5356736253d45b70b0702f69dd18e643dd5fb637e190121e78dbe652b1d
|
data/.travis.yml
CHANGED
data/History.txt
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
== 1.0.7
|
2
|
+
* Provide a wrapper function for calling context termination. Zeromq 3.x
|
3
|
+
uses zmq_ctx_destroy to terminate a context. While this function exists
|
4
|
+
in Zeromq 4.x, it is deprecated. For 4.x, we prefer to use zmq_ctx_term.
|
5
|
+
When loading the library, we define a `terminate_context` method on the
|
6
|
+
module which defaults to using the 3.x function call. If the 4.x support
|
7
|
+
loads, then this method is overwritten to use the 4.x function call.
|
8
|
+
|
data/lib/ffi-rzmq-core/libzmq.rb
CHANGED
@@ -44,12 +44,18 @@ module LibZMQ
|
|
44
44
|
ffi_lib(ZMQ_LIB_PATHS + %w{libzmq})
|
45
45
|
|
46
46
|
rescue LoadError
|
47
|
-
|
48
|
-
|
47
|
+
# Failed to load the zmq library
|
48
|
+
|
49
|
+
found_libs = ZMQ_LIB_PATHS.find_all {|path| File.file? path }
|
50
|
+
if found_libs.any?
|
49
51
|
warn "Unable to load this gem. The libzmq library exists, but cannot be loaded."
|
50
|
-
warn "
|
51
|
-
warn
|
52
|
-
|
52
|
+
warn "libzmq library was found at:"
|
53
|
+
warn found_libs.inspect
|
54
|
+
if FFI::Platform::IS_WINDOWS
|
55
|
+
warn "On Windows:"
|
56
|
+
warn "- Check that you have MSVC runtime installed or statically linked"
|
57
|
+
warn "- Check that your DLL is compiled for #{FFI::Platform::ADDRESS_SIZE} bit"
|
58
|
+
end
|
53
59
|
else
|
54
60
|
warn "Unable to load this gem. The libzmq library (or DLL) could not be found."
|
55
61
|
warn "If this is a Windows platform, make sure libzmq.dll is on the PATH."
|
@@ -123,4 +129,8 @@ module LibZMQ
|
|
123
129
|
# Monitoring API
|
124
130
|
attach_function :zmq_socket_monitor, [:pointer, :pointer, :int], :int, :blocking => true
|
125
131
|
|
132
|
+
# Wrapper function for context termination
|
133
|
+
def self.terminate_context(context)
|
134
|
+
zmq_ctx_destroy(context)
|
135
|
+
end
|
126
136
|
end
|
@@ -14,4 +14,9 @@ module LibZMQ
|
|
14
14
|
# Will return -1 with errno set to ENOSUP otherwise
|
15
15
|
attach_function :zmq_curve_keypair, [:pointer, :pointer], :int, :blocking => true
|
16
16
|
|
17
|
+
# Wrapper function for context termination
|
18
|
+
def self.terminate_context(context)
|
19
|
+
zmq_ctx_term(context)
|
20
|
+
end
|
21
|
+
|
17
22
|
end
|
data/spec/libzmq_spec.rb
CHANGED
@@ -45,4 +45,27 @@ describe LibZMQ do
|
|
45
45
|
expect(LibZMQ).to respond_to(:zmq_socket_monitor)
|
46
46
|
end
|
47
47
|
|
48
|
+
if LibZMQ.version3?
|
49
|
+
|
50
|
+
describe '.terminate_context' do
|
51
|
+
it 'calls the 3.x zmq_ctx_destroy function' do
|
52
|
+
context_dbl = double('context')
|
53
|
+
|
54
|
+
expect(LibZMQ).to receive(:zmq_ctx_destroy).with(context_dbl)
|
55
|
+
LibZMQ.terminate_context(context_dbl)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
elsif LibZMQ.version4?
|
60
|
+
|
61
|
+
describe '.terminate_context' do
|
62
|
+
it 'calls the 4.x zmq_ctx_destroy function' do
|
63
|
+
context_dbl = double('context')
|
64
|
+
|
65
|
+
expect(LibZMQ).to receive(:zmq_ctx_term).with(context_dbl)
|
66
|
+
LibZMQ.terminate_context(context_dbl)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
48
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-rzmq-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuck Remes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- ".gitignore"
|
65
65
|
- ".travis.yml"
|
66
66
|
- Gemfile
|
67
|
+
- History.txt
|
67
68
|
- LICENSE
|
68
69
|
- README.md
|
69
70
|
- Rakefile
|
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
version: '0'
|
103
104
|
requirements: []
|
104
105
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.7.3
|
106
107
|
signing_key:
|
107
108
|
specification_version: 4
|
108
109
|
summary: This gem provides only the FFI wrapper for the ZeroMQ (0mq) networking library.
|