lib/net/ldap/connection.rb in net-ldap-0.16.3 vs lib/net/ldap/connection.rb in net-ldap-0.17.0
- old
+ new
@@ -688,10 +688,10 @@
# Internal: Returns a Socket like object used internally to communicate with
# LDAP server.
#
# Typically a TCPSocket, but can be a OpenSSL::SSL::SSLSocket
def socket
- return @conn if defined? @conn
+ return @conn if defined?(@conn) && !@conn.nil?
# First refactoring uses the existing methods open_connection and
# prepare_socket to set @conn. Next cleanup would centralize connection
# handling here.
if @server[:socket]