Sha256: f142c5e1fb0febb4ac3899b6f24136c3f8e6316685cb4c79bc674f3777dd8ce9

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

# Copyright (C) 2019 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Mongo
  class Server

    # This class encapsulates connections during handshake and authentication.
    #
    # @api private
    class PendingConnection < ConnectionBase
      extend Forwardable

      def initialize(socket, description, server, monitoring, options = {})
        @socket = socket
        @description = description
        @options = options
        @server = server
        @monitoring = monitoring
        @id = options[:id]
      end

      # @return [ Integer ] The ID for the connection. This is the same ID
      #   as that of the regular Connection object for which this
      #   PendingConnection instance was created.
      attr_reader :id

      def ensure_connected
        yield @socket
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.12.4 lib/mongo/server/pending_connection.rb
mongo-2.12.3 lib/mongo/server/pending_connection.rb
mongo-2.12.2 lib/mongo/server/pending_connection.rb
mongo-2.12.1 lib/mongo/server/pending_connection.rb
mongo-2.12.0.rc0 lib/mongo/server/pending_connection.rb