cztop 0.9.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ecd770fb211c9e4ef5aaf15ad602c23ed5337aa
4
- data.tar.gz: ac11ecd5c536b2322594000bf5ab05c85763136d
3
+ metadata.gz: 117c17b6787d700550999d0302f299aebc833902
4
+ data.tar.gz: 1b81e1fb89f114c51d9646e439d606083cd6b446
5
5
  SHA512:
6
- metadata.gz: 0f29fa29f291dda39e7b43697e0ca1e13df1dc96321445f771c2324b0eae14f9680dcf2a1617c4c123c238a4840aabe193e5f0cbd2bf0503be760529c74b9ed0
7
- data.tar.gz: c422a1152c407d8215932a7d5be169f18dbe73e00c37ebffb8ab5bcff456fc9fc79b367f7f58c6e4fbb4bf9a389486fe6ef5fadebed9b255723357fd7745abe7
6
+ metadata.gz: 07ed4e2fa8914018dfa2806c1df8bd10b4ba610348e96c79500edc811311fc2b4d58841cf9b5cac7d7d30d9a91219acf58f86f595fee493e4e6e02332fb6f38e
7
+ data.tar.gz: b867d2966b91bc2b371f1a61386cb0d0899047e415f9753119852a55047c9c103da1acd302af8a5ae7efaa38c18a3dc66cb6fdc75df9d05b1152c547118fe6d3
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.10.0 (10/24/2016)
2
+ -----
3
+ * add Socket#readable? and #writable?
4
+ * Socket#options: memoize the OptionAccessor instance
5
+
1
6
  0.9.4 (10/22/2016)
2
7
  -----
3
8
  * Beacon#configure: correctly handle interrupt, and fix API doc
@@ -37,22 +37,22 @@ module CZTop::HasFFIDelegate
37
37
  # @param msg [String] error message
38
38
  # @raise [ArgumentError] if EINVAL was reported
39
39
  # @raise [Interrupt] if EINTR was reported
40
- # @raise [SocketError] if EAGAIN was reported
40
+ # @raise [SocketError] if EHOSTUNREACH was reported
41
41
  # @raise [SystemCallError] any other reported error (appropriate
42
42
  # SystemCallError subclass, if errno is known)
43
43
  def raise_zmq_err(msg = CZMQ::FFI::Errors.strerror,
44
44
  errno: CZMQ::FFI::Errors.errno)
45
45
 
46
+ case errno
47
+ when Errno::EINVAL::Errno then raise ArgumentError, msg, caller
48
+ when Errno::EINTR::Errno then raise Interrupt, msg, caller
49
+ when Errno::EHOSTUNREACH::Errno then raise SocketError, msg, caller
50
+
46
51
  # If the errno is known, the corresponding Errno::* exception is
47
52
  # automatically constructed. Otherwise, it'll be a plain SystemCallError.
48
53
  # In any case, #errno will return the corresponding errno.
49
- raise SystemCallError.new(msg, errno), msg, caller
50
- rescue Errno::EINVAL
51
- raise ArgumentError, msg, caller
52
- rescue Errno::EINTR
53
- raise Interrupt, msg, caller
54
- rescue Errno::EHOSTUNREACH
55
- raise SocketError, msg, caller
54
+ else raise SystemCallError.new(msg, errno), msg, caller
55
+ end
56
56
  end
57
57
 
58
58
  # Some class methods related to FFI delegates.
data/lib/cztop/socket.rb CHANGED
@@ -15,6 +15,7 @@ module CZTop
15
15
  # so remote clients are able to authenticate this server
16
16
  # @note You'll have to use a {CZTop::Authenticator}.
17
17
  # @return [void]
18
+ # @raise [ArgumentError] if there's no secret key in certificate
18
19
  def CURVE_server!(cert)
19
20
  options.CURVE_server = true
20
21
  cert.apply(self) # NOTE: desired: raises if no secret key in cert
data/lib/cztop/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CZTop
2
- VERSION = "0.9.4"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -10,9 +10,23 @@ module CZTop
10
10
  #
11
11
  module ZsockOptions
12
12
  # Access to the options of this socket.
13
- # @return [OptionsAccessor]
13
+ # @return [OptionsAccessor] the memoized options accessor
14
14
  def options
15
- OptionsAccessor.new(self)
15
+ @options ||= OptionsAccessor.new(self)
16
+ end
17
+
18
+ # Checks whether there's a message that can be read from the socket
19
+ # without blocking.
20
+ # @return [Boolean] whether the socket is readable
21
+ def readable?
22
+ (options.events & Poller::ZMQ::POLLIN) > 0
23
+ end
24
+
25
+ # Checks whether at least one message can be written to the socket without
26
+ # blocking.
27
+ # @return [Boolean] whether the socket is writable
28
+ def writable?
29
+ (options.events & Poller::ZMQ::POLLOUT) > 0
16
30
  end
17
31
 
18
32
  # Used to access the options of a {Socket} or {Actor}.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cztop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-22 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: czmq-ffi-gen