katcp 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/katcp/client.rb +11 -14
  2. data/lib/katcp/version.rb +1 -1
  3. metadata +5 -5
data/lib/katcp/client.rb CHANGED
@@ -112,32 +112,29 @@ module KATCP
112
112
  req_timeouts = 0
113
113
  while req_timeouts < 2
114
114
  # Use select to wait with timeout for data or error
115
- rd_wr_err = select([@socket], [], [@socket], @socket_timeout)
115
+ rd_wr_ex = select([@socket], nil, nil, @socket_timeout)
116
116
 
117
117
  # Handle timeout
118
- if rd_wr_err.nil?
118
+ if rd_wr_ex.nil?
119
119
  # Timeout, increment req_timeout if we're expecting a reply,
120
120
  # then try again
121
121
  req_timeouts += 1 if @reqname
122
122
  next
123
123
  end
124
124
 
125
- # Handle error
126
- if rd_wr_err[2][0]
127
- # Ignore unless we're expected a reply
128
- next unless @reqname
129
- # Otherwise, send double-bang error response, and give up
125
+ # OK to (try to) read!
126
+ line = nil
127
+ begin
128
+ # TODO: Monkey-patch gets so that it recognizes "\r" or "\n"
129
+ # as line endings. Currently only recognizes fixed strings,
130
+ # so for now go with "\n".
131
+ line = @socket.gets("\n")
132
+ rescue
133
+ # Uh-oh, send double-bang error response, and give up
130
134
  @rxq.enq(['!!socket-error'])
131
135
  throw :giveup
132
136
  end
133
137
 
134
- # OK to read!
135
-
136
- # TODO: Monkey-patch gets so that it recognizes "\r" or "\n" as
137
- # line endings. Currently only recognizes fixed strings, so for
138
- # now go with "\n".
139
- line = @socket.gets("\n")
140
-
141
138
  # If EOF
142
139
  if line.nil?
143
140
  # Send double-bang error response, and give up
data/lib/katcp/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  #++
4
4
 
5
5
  module KATCP
6
- VERSION = "0.1.6"
6
+ VERSION = "0.1.8"
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katcp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - David MacMahon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-25 00:00:00 Z
18
+ date: 2013-04-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: narray
@@ -59,7 +59,7 @@ rdoc_options:
59
59
  - -m
60
60
  - README
61
61
  - --title
62
- - Ruby/KATCP 0.1.6 Documentation
62
+ - Ruby/KATCP 0.1.8 Documentation
63
63
  require_paths:
64
64
  - lib
65
65
  required_ruby_version: !ruby/object:Gem::Requirement