Method: Mongo::Server::Monitor::Connection#disconnect!

Defined in:
lib/mongo/server/monitor/connection.rb

#disconnect!(options = nil) ⇒ true

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This method mutates the connection by setting the socket to nil if the closing succeeded.

Note:

This method accepts an options argument for compatibility with Server::Connections. However, all options are ignored.

Disconnect the connection.

Examples:

Disconnect from the host.

connection.disconnect!

Returns:

  • (true)

    If the disconnect succeeded.

Since:

  • 2.0.0



184
185
186
187
188
189
190
# File 'lib/mongo/server/monitor/connection.rb', line 184

def disconnect!(options = nil)
  if socket
    socket.close rescue nil
    @socket = nil
  end
  true
end