Request peer to send inv messages based on a bloom filter
@param {BloomFilter=} arg - An instance of BloomFilter
@param {Object} options
@extends Message
@constructor
488829
function FilterloadMessage(arg, options) {
  Message.call(this, options);
  this.command = 'filterload';
  $.checkArgument(
    _.isUndefined(arg) || arg instanceof BloomFilter,
    'An instance of BloomFilter or undefined is expected'
  );
  this.filter = arg;
}
802437
function Client(options) {
  var self = this;

  // Filers
  this.__filters_in__ = [];
  this.__filters_out__ = [];

  // Subscriptions
  this.__subscriptions__ = [];

  // Current node id
  this.__node_id__ = Math.floor(Math.random() * 1e10) + 1;

  // Message incremental counter
  this.__last_message_cnt__ = 0;

  // List of ignoring messages
  this.__ignore_list__ = {};

  // Router
  this.__router__ = options.router;

  this.__router__.onmessage(function (channel, message) {
    self.__onmessage__(channel, message);
  });

  // Lock handlers
  this.__lock_handlers__ = {};

  // If client make lock request - store handler and remove it from message
  this.filterOut(function (channel, message, callback) {
    if (channel === '!sys.lock.request') {
      var fn = message.data.fn;
      var lockId = message.data.id;

      delete message.data.fn;

      // Wrap handler to pass unlock function into it
      self.__lock_handlers__[message.id] = function () {
        fn(function unlock() {
          self.emit('!sys.lock.release', { id: lockId });
        });
      };
    }

    callback(channel, message);
  });

  // If lock acquired - execute handler
  this.filterIn(function (channel, message, callback) {
    if (channel === '!sys.lock.acquired' && self.__lock_handlers__[message.data.request_id]) {
      self.__lock_handlers__[message.data.request_id]();
      delete self.__lock_handlers__[message.data.request_id];
    }

    callback(channel, message);
  });
}
1055740
function (arg, fn, opts) {

  if (typeof arg === T_STRING) {

    // 2nd parameter is optional, but can be null
    if (isObject(fn)) {
      opts = fn;
      fn = false;
    }

    // `riot.compile(tag [, callback | true][, options])`
    if (/^\s*</m.test(arg)) {
      var js = compiler.compile(arg, opts);
      if (fn !== true) { globalEval(js); }
      if (isFunction(fn)) { fn(js, arg, opts); }
      return js
    }

    // `riot.compile(url [, callback][, options])`
    GET(arg, function (str, opts, url) {
      var js = compiler.compile(str, opts, url);
      globalEval(js, url);
      if (fn) { fn(js, str, opts); }
    }, opts);

  } else if (isArray(arg)) {
    var i = arg.length;
    // `riot.compile([urlsList] [, callback][, options])`
    arg.forEach(function(str) {
      GET(str, function (str, opts, url) {
        var js = compiler.compile(str, opts, url);
        globalEval(js, url);
        i --;
        if (!i && fn) { fn(js, str, opts); }
      }, opts);
    });
  } else {

    // `riot.compile([callback][, options])`
    if (isFunction(arg)) {
      opts = fn;
      fn = arg;
    } else {
      opts = arg;
      fn = undefined;
    }

    if (ready) {
      return fn && fn()
    }

    if (promise) {
      if (fn) { promise.on('ready', fn); }

    } else {
      promise = observable$1();
      compileScripts(fn, opts);
    }
  }

}
19755
function (args, callback) {
        ternserver.request({
            query: {
              type: "type",  //$NON-NLS-1$
              file: args.meta.location,
              end: args.params.offset
            }
          },
          function (error, type) {
            if (error) {
              callback({
                request: 'type',
                error: typeof error === 'string' ? error : error.message,
                message: Messages['failedType']
              }); //$NON-NLS-1$
            } else {
              callback({request: 'type', type: type}); //$NON-NLS-1$
            }
          });
      }
1085922
function (args) {
            var req = args.req;
            var handler = args.requestHandler;
            if (handler == null) {
                handler = this.__getRequestHandler();
            }

            req.data = (req.data == null && req.method == "POST")
                    ? handler.prepareRequestBody(req.jsonData, req.requestObject)
                    : req.data;
            req.headers = handler.getRequestHeaders();
            if (req.requestObject.headers) {
                req.headers = ariaUtilsJson.copy(req.headers, false);
                ariaUtilsJson.inject(req.requestObject.headers, req.headers, false);
            }

            // call the server
            var senderObject = {
                classpath : this.$classpath,
                requestObject : req.requestObject,
                requestData : req.jsonData,

                // the following two properties can be used to communicate from the filters to the RequestMgr and bypass
                // the handler:
                responseData : null,
                responseErrorData : null
            };

            var requestObject = {
                sender : senderObject,
                url : req.url,
                async : (req.requestObject.async !== false),
                method : req.method,
                data : req.data,
                headers : req.headers,
                timeout : req.timeout,
                callback : {
                    fn : this._onresponse,
                    onerror : this._onresponse,
                    scope : this,
                    args : {
                        requestObject : req.requestObject,
                        senderObject : senderObject,
                        cb : args.cb,
                        id : args.id,
                        session : args.session,
                        actionQueuing : args.actionQueuing,
                        requestHandler : handler
                    }
                }
            };
            if (handler.expectedResponseType) {
                requestObject.expectedResponseType = handler.expectedResponseType;
            }
            ariaCoreIO.asyncRequest(requestObject);
        }
947101
function ( options ) {
			this.protocol = options.protocol || 'http';
			this.port = options.port;
			this.server = options.server;
			this.path = options.path;
			this.proxy = options.proxy;
			this.jar = request.jar(); // create new cookie jar for each instance

			this.debug = options.debug;

			// set up logging
			const winston = require( 'winston' ),
				// file logging
				path = require( 'path' ),
				fs = require( 'fs' ),
				logDir = path.dirname( process.argv[ 1 ] ) + '/log/',
				logFile = logDir + path.basename( process.argv[ 1 ], '.js' ) + '.log',
				// how many tasks (i.e. requests) to run in parallel
				concurrency = options.concurrency || 3;

			this.logger = new ( winston.Logger )();

			// console logging
			if ( this.debug ) {
				this.logger.add( winston.transports.Console, {
					level: 'debug'
				} );
			}

			this.logger.cli();

			if ( fs.existsSync( logDir ) ) {
				this.logger.add( winston.transports.File, {
					colorize: true,
					filename: logFile,
					json: false,
					level: this.debug ? 'debug' : 'info'
				} );
			}

			// requests queue
			// @see https://github.com/caolan/async#queue
			this.queue = async.queue( function ( task, callback ) {
			// process the task (and call the provided callback once it's completed)
				task( callback );
			}, concurrency );

			// HTTP client
			this.formatUrl = require( 'url' ).format;

			this.userAgent = options.userAgent || ( `nodemw/${VERSION} (node.js ${process.version}; ${process.platform} ${process.arch})` );
			this.version = VERSION;

			// debug info
			this.info( process.argv.join( ' ' ) );
			this.info( this.userAgent );

			let port = this.port ? `:${this.port}` : '';

			this.info( `Using <${this.protocol}://${this.server}${port}${this.path}/api.php> as API entry point` );
			this.info( '----' );
		}
1041205
function onProcCall(method, path, args) {
    let re;
    switch (method) {
    case 'GET':
        if (path === '') { // Request for members
            return listKeys(args);
        }
        re = localStorage.getItem(path);
        return (re == null ? {errors: [{error: 'No such path:'+path}]} : re);
    case 'POST':
    case 'PUT':
        try {
            localStorage.setItem(path, args);
            pi.server.publish(path, args); // PubSub
            return {success: true};
        } catch (e) {
            return {errors: [{error: 'Data should be in JSON format.'}]};
        }
    case 'DELETE':
        if (path == '') localStorage.clear();
        else localStorage.removeItem(path);
        pi.server.publish(path, {}); // PubSub
        return {success: true};
    default:
        return {errors: [{error: `The specified method ${method} is not implemented in admin plugin.`}]}; // eslint-disable-line max-len
    }
}
41826
function ws(argv, callback) {
  if (!argv[2]) {
    console.error("url is required");
    console.error("Usage : ws <url>");
    process.exit(-1);
  }
  var uri = argv[2];
  var updatesVia = 'wss://' + uri.split('/')[2] + '/';

  var s;

  var connect = function(){
    s = new wss(updatesVia, {
      origin: 'http://websocket.org'
    });

    s.on('error', function() {
      callback('socket error');
      setTimeout(connect, RECONNECT);
    });

    s.on('open', function open() {
      var sub = 'sub ' + uri;
      callback(null, sub);
      s.send(sub);

      // periodically ping server
      setInterval(function() {
        var message = 'ping';
        debug(null, message);
        s.send(message);
      }, INTERVAL);
    });

  };
  connect();

  s.on('message', function message(data, flags) {
    callback(null, data);
  });

}
278984
function (reason, offendingMessage) {
    var self = this;
    var msg = {msg: 'error', reason: reason};
    if (offendingMessage)
      msg.offendingMessage = offendingMessage;
    self.send(msg);
  }
126109
function verifyArguments(args) {
	const isInvalid = args.some((arg) => typeof arg !== 'string');
	if (isInvalid) {
		const argsString = args.map((arg) => util.format('%j', arg)).join(', ');
		const msg = util.format('Transaction arguments must be strings: %s', argsString);
		logger.error('verifyArguments:', msg);
		throw new Error(msg);
	}
}
1299436
function exists(req, res, args) {
  this.spawn();
  this.reply(req, res);
  // need to coerce buffers for the moment
  args = args.map(function(a) {
    if(a instanceof Buffer) return a.toString();
    return a;
  })
  this.ps.send({event: 'exists', args: args});
}
1043073
public static void main(String[] args) {
    validateArguments(args);

    EchoClient echoClient = newEchoClient(lenientParsePort(args[0]));

    for (int index = 1; index < args.length; index++) {
      System.out.println(echoClient.sendMessage(args[index]));
    }
  }
280822
function handleArguments(args) {
  return new Promise(function(resolve, reject) {
    var requires = [];
    var promises = [];

    // check for Promises in args
    if (args && args instanceof Array) {
      args.some(function (arg, i) {
        if ((arg.value === null || typeof(arg.value) == 'undefined') && arg.optional) {
          return true;
        }

        if (arg.value && Array.isArray(arg.value) && arg.optional && arg.value.length == 0) {
          return true;
        }

        if (arg.type == 'string') {
          var s = '"' + arg.value.replace(/"/g, '\\\"') + '"';
          promises.push(Promise.resolve(s));
        } else if (arg.type == 'lambda') {
          promises.push(serializeLambda(arg.value));
        } else if (arg.type == 'lambdaArgs') {
          promises.push(new Promise(function(resolve, reject) {
            handleArrayArgument(arg.value).then(function (result) {
              resolve(result);
            }).catch(reject);
          }));
        } else if (arg.type == 'map') {
          promises.push(Promise.resolve(JSON.stringify(arg.value)));
        } else if (arg.type == 'promise') {
          promises.push(new Promise(function(resolve, reject) {
            arg.value.then(function(val) {
              if (typeof(val) == 'string') {
                if (isNaN(val)) {
                  // a string
                  var s = '"' + val.replace(/"/g, '\\\"') + '"';
                  resolve(s);
                } else {
                  resolve(parseFloat(val));
                }
              } else {
                resolve(val);
              }
            });
          }));
        } else if (arg.value.refIdP) {
          promises.push(arg.value.refIdP);
        } else if (arg.type == 'List') {
          promises.push(Promise.resolve(arg.value.toString()));
        } else if (arg.type == 'array') {
          // simple array argument
          promises.push(handleArrayArgument(arg.value));
        } else if (arg.type == '_eclairSerialize') {
          if (arg.value._eclairSerialize == 'staticProperty') {
            var val = arg.value.ref.name + '.' + arg.value.value;
            promises.push(Promise.resolve(val));
            requires.push({name: arg.value.ref.name, moduleLocation: arg.value.ref.moduleLocation});
          }
        } else if (Array.isArray(arg.value)) {
          // TODO: should we try to wrap the array if it isn't?
          promises.push(new Promise(function (resolve, reject) {
            handleArguments(arg.value).then(function (result) {
              if (result.requires.length > 0) {
                result.requires.forEach(function (r) {
                  requires.push(r)
                });
              }

              resolve('[' + result.args + ']');
            }).catch(reject);
          }));
        } else if (arg.type == '_eclairForceFloat') {
          var val = arg.value.value;
          if (val.toString().indexOf('.') === -1) {
            val = val.toFixed(1);
          }
          promises.push(Promise.resolve(val));
        } else if (arg.type == '_eclairLocal') {
          promises.push(Promise.resolve(arg.value._generateRemote().refIdP));
        } else if (arg.type == 'sparkclassref') {
          // we have a spark class reference, so return its name
          promises.push(Promise.resolve(arg.value.name));
          // add the class to the requires list
          requires.push({name: arg.value.name, moduleLocation: arg.value.moduleLocation});
        } else {
          promises.push(Promise.resolve(arg.value));
        }

        return false;
      });
    }

    Promise.all(promises).then(function(finalArgs) {
      resolve({args: finalArgs, requires: requires});
      //resolve(finalArgs);
    }).catch(function(e) {
      console.log(e);
      reject(e)
    });
  });
}
740894
function PongMessage(arg, options) {
  Message.call(this, options);
  this.command = 'pong';
  $.checkArgument(
    _.isUndefined(arg) || (BufferUtil.isBuffer(arg) && arg.length === 8),
    'First argument is expected to be an 8 byte buffer'
  );
  this.nonce = arg || utils.getNonce();
}
64365
function ( arg ) {
		if ( arg === undefined ) {
			arg = this || utility.$;
		}

		arg = arg.toString().match( regex.reflect )[1];

		return string.explode( arg );
	}
32616
def command_callback(id, buffer, args)
      Weechat::Command.find_by_id(id).call(Weechat::Buffer.from_ptr(buffer), args)
    end
348776
function(args, options, cb) {

                args = !_.isArray(args) ? [args] : args;
                args = options && args.concat(helper.optsToArgs(options)) || args;

                var child = grunt.util.spawn({
                    cmd:"node",
                    args:args
                }, function (error, result, code) {
                    cb(error);
                });

                child.stdout.pipe(process.stdout);
                child.stderr.pipe(process.stderr);

            }