# File lib/mongo/mongo_client.rb, line 437 def connect close config = check_is_master(host_port) if config if config['ismaster'] == 1 || config['ismaster'] == true @read_primary = true elsif @slave_ok @read_primary = false end if config.has_key?('msg') && config['msg'] == 'isdbgrid' @mongos = true end @max_bson_size = config['maxBsonObjectSize'] @max_message_size = config['maxMessageSizeBytes'] set_primary(host_port) end if !connected? raise ConnectionFailure, "Failed to connect to a master node at #{host_port.join(":")}" end end