Skip to content

Commit e4f1293

Browse files
committed
used connect_nonblock for socket
1 parent fe4c0ff commit e4f1293

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

lib/splitclient-rb/sse/event_source/client.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,21 @@ def socket_connect
156156
ssl_context = OpenSSL::SSL::SSLContext.new
157157
ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ssl_context)
158158
ssl_socket.hostname = @uri.host
159-
ssl_socket.connect
160-
return ssl_socket.connect
159+
160+
begin
161+
ssl_socket.connect_nonblock
162+
rescue IO::WaitReadable
163+
IO.select([ssl_socket])
164+
retry
165+
rescue IO::WaitWritable
166+
IO.select(nil, [ssl_socket])
167+
retry
168+
end
169+
170+
return ssl_socket
171+
# return ssl_socket.connect
161172
rescue Exception => e
162173
@config.logger.error("socket connect error: #{e.inspect}")
163-
puts e.inspect
164174
return nil
165175
end
166176
end

lib/splitclient-rb/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module SplitIoClient
2-
VERSION = '8.10.0-rc1'
2+
VERSION = '8.10.0-rc2'
33
end

0 commit comments

Comments
 (0)