zas-client 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/zas/client.rb +8 -4
  2. metadata +2 -2
data/lib/zas/client.rb CHANGED
@@ -43,7 +43,7 @@ module Zas
43
43
  # within the timeout as specified the configuration.
44
44
  def authenticate(credentials)
45
45
  begin
46
- socket.send credentials.to_wire
46
+ raise("Send failed") unless socket.send(credentials.to_wire)
47
47
  logger.debug "Selecting on socket #{socket.inspect} with timeout #{timeout}"
48
48
  if ZMQ.select([socket], nil, nil, timeout)
49
49
  logger.debug("Receiving from socket #{socket.inspect}")
@@ -54,8 +54,11 @@ module Zas
54
54
  raise Zas::TimeoutError, "Response from authentication service not received in time"
55
55
  end
56
56
  rescue IOError => e
57
- logger.error "IO error occurred: #{e.message}"
58
- end
57
+ logger.error "IO error occurred: #{e.message}"
58
+ rescue => e
59
+ logger.error "Error occurred: #{e.message}"
60
+ raise
61
+ end
59
62
  end
60
63
 
61
64
  # Public: Disconnect the socket.
@@ -110,7 +113,8 @@ module Zas
110
113
  def build_socket
111
114
  if context
112
115
  logger.info "Building new socket for Zas Client, connecting to #{host}:#{port}"
113
- socket = context.socket ZMQ::REQ
116
+ socket = context.socket(ZMQ::REQ)
117
+ socket.setsockopt(ZMQ::LINGER, 0)
114
118
  socket.connect "tcp://#{host}:#{port}"
115
119
  socket
116
120
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zas-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-09 00:00:00.000000000 Z
12
+ date: 2012-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zmq