Skip to content

Commit 510c942

Browse files
committed
Merge pull request #635 from estolfo/eof
Fix socket references
2 parents 47de565 + 3601ea5 commit 510c942

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

lib/mongo/socket.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class Socket
5656
#
5757
# @since 2.0.0
5858
def alive?
59-
sock_arr = [@socket]
59+
sock_arr = [ @socket ]
6060
if Kernel::select(sock_arr, nil, sock_arr, 0)
61-
!eof?
61+
!@socket.eof?
6262
else
6363
true
6464
end
@@ -75,7 +75,7 @@ def alive?
7575
#
7676
# @since 2.0.0
7777
def close
78-
socket.close rescue true
78+
@socket.close rescue true
7979
true
8080
end
8181

lib/mongo/socket/ssl.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ def connect!
6363
end
6464
end
6565

66-
# Tests if this socket has reached EOF. Primarily used for liveness checks.
67-
#
68-
# @since 2.0.0
69-
def eof?
70-
@tcp_socket.eof?
71-
end
72-
7366
# Initializes a new SSL socket.
7467
#
7568
# @example Create the SSL socket.

spec/mongo/socket/ssl_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
end
4545
end
4646

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

4949
let(:options) do
5050
{

spec/spec_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def list_command_enabled?
146146
$list_command_enabled ||= $mongo_client.cluster.servers.first.features.list_indexes_enabled?
147147
end
148148

149+
def testing_locally?
150+
!(ENV['CI'] || ENV['JENKINS_HOME'])
151+
end
152+
149153
def running_ssl?
150154
SSL
151155
end

0 commit comments

Comments
 (0)