lib/control-connection.js
function ControlConnection(options, profileManager, context) {
  this.protocolVersion = null;
  this.hosts = new HostMap();
  this.setMaxListeners(0);
  Object.defineProperty(this, "options", { value: options, enumerable: false, writable: false});
  /**
   * Cluster metadata that is going to be shared between the Client and ControlConnection
   */
  this.metadata = new Metadata(this.options, this);
  this.addressTranslator = this.options.policies.addressResolution;
  this.reconnectionPolicy = this.options.policies.reconnection;
  this.reconnectionSchedule = this.reconnectionPolicy.newSchedule();
  this.initialized = false;
  this.isShuttingDown = false;
  /**
   * Host used by the control connection
   * @type {Host|null}
   */
  this.host = null;
  /**
   * Connection used to retrieve metadata and subscribed to events
   * @type {Connection|null}
   */
  this.connection = null;
  /**
   * Reference to the encoder of the last valid connection
   * @type {Encoder|null}
   */
  this.encoder = null;
  this.debouncer = new EventDebouncer(options.refreshSchemaDelay, this.log.bind(this));
  this.profileManager = profileManager;
  /** Timeout used for delayed handling of topology changes */
  this.topologyChangeTimeout = null;
  /** Timeout used for delayed handling of node status changes */
  this.nodeStatusChangeTimeout = null;
  this.reconnectionTimeout = null;
  this.hostIterator = null;
  this.triedHosts = null;
  this._resolvedContactPoints = new Map();
  this._contactPoints = new Set();

  if (context && context.borrowHostConnection) {
    this.borrowHostConnection = context.borrowHostConnection;
  }

  if (context && context.createConnection) {
    this.createConnection = context.createConnection;
  }
}
function ControlConnection(options, profileManager, context) {
  this.protocolVersion = null;
  this.hosts = new HostMap();
  this.setMaxListeners(0);
  Object.defineProperty(this, "options", { value: options, enumerable: false, writable: false});
  /**
   * Cluster metadata that is going to be shared between the Client and ControlConnection
   */
  this.metadata = new Metadata(this.options, this);
  this.addressTranslator = this.options.policies.addressResolution;
  this.reconnectionPolicy = this.options.policies.reconnection;
  this.reconnectionSchedule = this.reconnectionPolicy.newSchedule();
  this.initialized = false;
  this.isShuttingDown = false;
  /**
   * Host used by the control connection
   * @type {Host|null}
   */
  this.host = null;
  /**
   * Connection used to retrieve metadata and subscribed to events
   * @type {Connection|null}
   */
  this.connection = null;
  /**
   * Reference to the encoder of the last valid connection
   * @type {Encoder|null}
   */
  this.encoder = null;
  this.debouncer = new EventDebouncer(options.refreshSchemaDelay, this.log.bind(this));
  this.profileManager = profileManager;
  /** Timeout used for delayed handling of topology changes */
  this.topologyChangeTimeout = null;
  /** Timeout used for delayed handling of node status changes */
  this.nodeStatusChangeTimeout = null;
  this.reconnectionTimeout = null;
  this.hostIterator = null;
  this.triedHosts = null;
  this._resolvedContactPoints = new Map();
  this._contactPoints = new Set();

  if (context && context.borrowHostConnection) {
    this.borrowHostConnection = context.borrowHostConnection;
  }

  if (context && context.createConnection) {
    this.createConnection = context.createConnection;
  }
}
function ControlConnection ( options , profileManager , context ) { this . protocolVersion = null ; this . hosts = new HostMap ( ) ; this . setMaxListeners ( 0 ) ; Object . defineProperty ( this , "options" , { value : options , enumerable : false , writable : false } ) ; /**
   * Cluster metadata that is going to be shared between the Client and ControlConnection
   */ this . metadata = new Metadata ( this . options , this ) ; this . addressTranslator = this . options . policies . addressResolution ; this . reconnectionPolicy = this . options . policies . reconnection ; this . reconnectionSchedule = this . reconnectionPolicy . newSchedule ( ) ; this . initialized = false ; this . isShuttingDown = false ; /**
   * Host used by the control connection
   * @type {Host|null}
   */ this . host = null ; /**
   * Connection used to retrieve metadata and subscribed to events
   * @type {Connection|null}
   */ this . connection = null ; /**
   * Reference to the encoder of the last valid connection
   * @type {Encoder|null}
   */ this . encoder = null ; this . debouncer = new EventDebouncer ( options . refreshSchemaDelay , this . log . bind ( this ) ) ; this . profileManager = profileManager ; /** Timeout used for delayed handling of topology changes */ this . topologyChangeTimeout = null ; /** Timeout used for delayed handling of node status changes */ this . nodeStatusChangeTimeout = null ; this . reconnectionTimeout = null ; this . hostIterator = null ; this . triedHosts = null ; this . _resolvedContactPoints = new Map ( ) ; this . _contactPoints = new Set ( ) ; if ( context && context . borrowHostConnection ) { this . borrowHostConnection = context . borrowHostConnection ; } if ( context && context . createConnection ) { this . createConnection = context . createConnection ; } }
Creates a new instance of <code>ControlConnection</code>.
@classdesc
Represents a connection used by the driver to receive events and to check the status of the cluster.
<p>It uses an existing connection from the hosts' connection pool to maintain the driver metadata up-to-date.</p>
@param {Object} options
@param {ProfileManager} profileManager
@param {{borrowHostConnection: function, createConnection: function}} [context] An object containing methods to
allow dependency injection.
@extends EventEmitter
@constructor
Creates a new instance of <code > ControlConnection< / code > .