packages/grpc-native-core/src/server.js
function waitForCancel() {
  /* jshint validthis: true */
  var self = this;
  var cancel_batch = {};
  cancel_batch[grpc.opType.RECV_CLOSE_ON_SERVER] = true;
  self.call.startBatch(cancel_batch, function(err, result) {
    if (err) {
      self.emit('error', err);
    }
    if (result.cancelled) {
      self.cancelled = true;
      self.emit('cancelled');
    }
  });
}
function waitForCancel() {
  /* jshint validthis: true */
  var self = this;
  var cancel_batch = {};
  cancel_batch[grpc.opType.RECV_CLOSE_ON_SERVER] = true;
  self.call.startBatch(cancel_batch, function(err, result) {
    if (err) {
      self.emit('error', err);
    }
    if (result.cancelled) {
      self.cancelled = true;
      self.emit('cancelled');
    }
  });
}
function waitForCancel ( ) { /* jshint validthis: true */ var self = this ; var cancel_batch = { } ; cancel_batch [ grpc . opType . RECV_CLOSE_ON_SERVER ] = true ; self . call . startBatch ( cancel_batch , function ( err , result ) { if ( err ) { self . emit ( 'error' , err ) ; } if ( result . cancelled ) { self . cancelled = true ; self . emit ( 'cancelled' ) ; } } ) ; }
Wait for the client to close, then emit a cancelled event if the client
cancelled.
@private
Wait for the client to close then emit a cancelled event if the client cancelled .