lib/RemoteSlave.js
/**
   * Handles responses, and is called when the socket connection associated with this slave emits a "message" message.
   * @param {Object<String|Number|Object>} m The message from the master proxy server.
   * @return {undefined}
   */
Handles responses, and is called when the socket connection associated with this slave emits a "message" message.
@param {Object} m The message from the master proxy server.
@return {undefined}
Handles responses and is called when the socket connection associated with this slave emits a " message " message . @param { Object } m The message from the master proxy server . @return { undefined }
slaveResponseListener(m) {
    if (this.isSlaveMessage(m)) {
      const pendingRequests = Slave.pendingRequests;
      if (pendingRequests[m.request.for] && pendingRequests[m.request.for][m.request.rid]) {
        const request = pendingRequests[m.request.for][m.request.rid];
        request.clearTimeout();
        const response = new Response(m);
        delete pendingRequests[m.request.for][m.request.rid];
        if (request.hasTimedout(response)) {
        } else if (request.callback instanceof Function) {
          request.callback.call(response, response, request);
        }
      }
    } else if (Slave.isSlaveExceptionMessage(m)) {
      const e = new Error(m.error.message || 'Unknown error');
      e.stack = m.error.stack;
      e.name = m.error.name;
      if (this.id === m.from) {
        if (this.listenerCount('uncaughtException') === 0) {
          throw e;
        } else {
          this.emit('uncaughtException', e);
        }
      }
    }
  }
slaveResponseListener ( m ) { if ( this . isSlaveMessage ( m ) ) { const pendingRequests = Slave . pendingRequests ; if ( pendingRequests [ m . request . for ] && pendingRequests [ m . request . for ] [ m . request . rid ] ) { const request = pendingRequests [ m . request . for ] [ m . request . rid ] ; request . clearTimeout ( ) ; const response = new Response ( m ) ; delete pendingRequests [ m . request . for ] [ m . request . rid ] ; if ( request . hasTimedout ( response ) ) { } else if ( request . callback instanceof Function ) { request . callback . call ( response , response , request ) ; } } } else if ( Slave . isSlaveExceptionMessage ( m ) ) { const e = new Error ( m . error . message || 'Unknown error' ) ; e . stack = m . error . stack ; e . name = m . error . name ; if ( this . id === m . from ) { if ( this . listenerCount ( 'uncaughtException' ) === 0 ) { throw e ; } else { this . emit ( 'uncaughtException' , e ) ; } } } }
Handles responses, and is called when the socket connection associated with this slave emits a "message" message.
Handles responses and is called when the socket connection associated with this slave emits a " message " message .
// Create a new response object from the message. // Remove the message from the pending queue. // Ignore the message, no op... // Invoke the callback for the message. /**
         * Emitted when a slave exception occurs.
         * @event uncaughtException
         * @argument {Error} The error emitted from the slave.
         */