lib/client.js
function Client(socket) {

  // flag whether an external or internal client socket
  this._tcp = (socket instanceof Socket);

  // index into the connections array
  this._index = -1;

  // file descriptor
  this._fd = socket._handle.fd;

  // remote ip address
  this._remoteAddress = socket.remoteAddress;

  // remote port
  this._remotePort = socket.remotePort;

  // full remote address
  this._addr =
    (this._remoteAddress && this._remotePort)
      ? this._remoteAddress + ':' + this._remotePort : null;

  // connection id (2^53)
  this._id = ++id;

  // connection name used by setname/getname
  this._name = null;

  // flag used to mark clients as authenticated
  this._authenticated = false;

  // current db for this connection
  this.db = 0;

  // transaction reference for multi blocks
  this._transaction = null;

  // map of keys being watched by this connection
  this._watched = {};

  // monitor slave mode
  this._monitor = false;

  // the timestamp (ms) when this connection was established
  this._connected = Date.now();

  // last command played
  this._cmd = null;

  // buffer for queries
  this._qbuf = new Buffer(0);

  // time when the last command was received, used
  // to get idle time
  this._last = Date.now();

  // encapsulates pubsub state for this client
  this._pubsub = null;
}
function Client(socket) {

  // flag whether an external or internal client socket
  this._tcp = (socket instanceof Socket);

  // index into the connections array
  this._index = -1;

  // file descriptor
  this._fd = socket._handle.fd;

  // remote ip address
  this._remoteAddress = socket.remoteAddress;

  // remote port
  this._remotePort = socket.remotePort;

  // full remote address
  this._addr =
    (this._remoteAddress && this._remotePort)
      ? this._remoteAddress + ':' + this._remotePort : null;

  // connection id (2^53)
  this._id = ++id;

  // connection name used by setname/getname
  this._name = null;

  // flag used to mark clients as authenticated
  this._authenticated = false;

  // current db for this connection
  this.db = 0;

  // transaction reference for multi blocks
  this._transaction = null;

  // map of keys being watched by this connection
  this._watched = {};

  // monitor slave mode
  this._monitor = false;

  // the timestamp (ms) when this connection was established
  this._connected = Date.now();

  // last command played
  this._cmd = null;

  // buffer for queries
  this._qbuf = new Buffer(0);

  // time when the last command was received, used
  // to get idle time
  this._last = Date.now();

  // encapsulates pubsub state for this client
  this._pubsub = null;
}
function Client ( socket ) { // flag whether an external or internal client socket this . _tcp = ( socket instanceof Socket ) ; // index into the connections array this . _index = - 1 ; // file descriptor this . _fd = socket . _handle . fd ; // remote ip address this . _remoteAddress = socket . remoteAddress ; // remote port this . _remotePort = socket . remotePort ; // full remote address this . _addr = ( this . _remoteAddress && this . _remotePort ) ? this . _remoteAddress + ':' + this . _remotePort : null ; // connection id (2^53) this . _id = ++ id ; // connection name used by setname/getname this . _name = null ; // flag used to mark clients as authenticated this . _authenticated = false ; // current db for this connection this . db = 0 ; // transaction reference for multi blocks this . _transaction = null ; // map of keys being watched by this connection this . _watched = { } ; // monitor slave mode this . _monitor = false ; // the timestamp (ms) when this connection was established this . _connected = Date . now ( ) ; // last command played this . _cmd = null ; // buffer for queries this . _qbuf = new Buffer ( 0 ) ; // time when the last command was received, used // to get idle time this . _last = Date . now ( ) ; // encapsulates pubsub state for this client this . _pubsub = null ; }
Encapsulates client connection state.
Encapsulates client connection state .