ws_client 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ws_client/version.rb +1 -1
- data/lib/ws_client.rb +25 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab35da491f4c5d26b8afd50f14e0f195c44db4a2
|
4
|
+
data.tar.gz: db726294b252fd3494b1c80c91b92f5e1c231032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c0d8d40e04d5f255c31b7417efbe4af44126315fabe84ba3abf9414254d26d0f5710e803cdfed148b26cda6cb009535a33c3e232b15ae004f4065ac23169ffb
|
7
|
+
data.tar.gz: 64f09b2ec2e11af8744950987dee3596516f0fe1b90c9317c698b5331422f040b30f0cafdecaf9f66db1aa92a4e925745e3c7e3738ea6de941ee78348b0823b2
|
data/lib/ws_client/version.rb
CHANGED
data/lib/ws_client.rb
CHANGED
@@ -58,6 +58,11 @@ module WsClient
|
|
58
58
|
@closed = false
|
59
59
|
|
60
60
|
handshake
|
61
|
+
rescue OpenSSL::SSL::SSLError, EOFError
|
62
|
+
# Re-use the socket cleanup logic if we have a connect failure.
|
63
|
+
@pipe_broken = true
|
64
|
+
close
|
65
|
+
raise
|
61
66
|
end
|
62
67
|
|
63
68
|
def reconnect
|
@@ -172,21 +177,27 @@ module WsClient
|
|
172
177
|
|
173
178
|
def write_data(data, opt)
|
174
179
|
frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data, :type => opt[:type], :version => @handshake.version)
|
180
|
+
frame_str = frame.to_s
|
175
181
|
|
176
|
-
|
177
|
-
@
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
IO
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
182
|
+
loop do
|
183
|
+
break if frame_str.empty? || @closed
|
184
|
+
|
185
|
+
begin
|
186
|
+
num_bytes_written = @socket.write_nonblock(frame_str)
|
187
|
+
frame_str = frame_str[num_bytes_written..-1]
|
188
|
+
rescue IO::WaitReadable
|
189
|
+
IO.select([@socket]) # OpenSSL needs to read internally
|
190
|
+
retry
|
191
|
+
rescue IO::WaitWritable, Errno::EINTR
|
192
|
+
IO.select(nil, [@socket])
|
193
|
+
retry
|
194
|
+
rescue Errno::EPIPE => e
|
195
|
+
@pipe_broken = true
|
196
|
+
close
|
197
|
+
rescue => e
|
198
|
+
close
|
199
|
+
emit :error, e
|
200
|
+
end
|
190
201
|
end
|
191
202
|
end
|
192
203
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ws_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Dewitt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|