Skip to content

Fix socket references #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/mongo/socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class Socket
#
# @since 2.0.0
def alive?
sock_arr = [@socket]
sock_arr = [ @socket ]
if Kernel::select(sock_arr, nil, sock_arr, 0)
!eof?
!@socket.eof?
else
true
end
Expand All @@ -75,7 +75,7 @@ def alive?
#
# @since 2.0.0
def close
socket.close rescue true
@socket.close rescue true
true
end

Expand Down
7 changes: 0 additions & 7 deletions lib/mongo/socket/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ def connect!
end
end

# Tests if this socket has reached EOF. Primarily used for liveness checks.
#
# @since 2.0.0
def eof?
@tcp_socket.eof?
end

# Initializes a new SSL socket.
#
# @example Create the SSL socket.
Expand Down
2 changes: 1 addition & 1 deletion spec/mongo/socket/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
end
end

context 'when a CA certificate is provided' do
context 'when a CA certificate is provided', if: running_ssl? && testing_locally? do

let(:options) do
{
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def list_command_enabled?
$list_command_enabled ||= $mongo_client.cluster.servers.first.features.list_indexes_enabled?
end

def testing_locally?
!(ENV['CI'] || ENV['JENKINS_HOME'])
end

def running_ssl?
SSL
end
Expand Down