<commit_before>
/**
 * Round-robin plugin.
 *
 * Provides a `send` method which will
 * write the `msg` to all connected peers.
 *
 * @param {Object} options
 * @api private
 */

module.exports = function(options){
  options = options || {};
  fallback = options.fallback || function(){};

  return function(sock){

    /**
     * Bind callback to `sock`.
     */

    fallback = fallback.bind(sock);

    /**
     * Initialize counter.
     */

    var n = 0;

    /**
     * Sends `msg` to all connected peers.
     */

    sock.send = function(msg){
      var socks = this.socks
        , len = socks.length
        , sock = socks[n++ % len];

      if (sock) {
        sock.write(this.pack(msg));
      } else {
        fallback(msg);
      }
    };

  };
};<commit_msg>handle multipart<commit_after>
/**
 * Round-robin plugin.
 *
 * Provides a `send` method which will
 * write the `msg` to all connected peers.
 *
 * @param {Object} options
 * @api private
 */

module.exports = function(options){
  options = options || {};
  fallback = options.fallback || function(){};

  return function(sock){

    /**
     * Bind callback to `sock`.
     */

    fallback = fallback.bind(sock);

    /**
     * Initialize counter.
     */

    var n = 0;

    /**
     * Sends `msg` to all connected peers.
     */

    sock.send = function(msg){
      var socks = this.socks
        , len = socks.length
        , sock = socks[n++ % len]
        , args = [];

      if (Array.isArray(msg)) {
        args = msg;
      } else {
        for (var i = 0; i < arguments.length; ++i) {
          args[i] = arguments[i];
        }
      }

      if (sock) {
        sock.write(this.pack(args));
      } else {
        fallback(msg);
      }
    };

  };
};
{'fraction_non_alphanumeric': 0.15702005730659027, 'fraction_numerical': 0.0017191977077363897, 'mean_word_length': 1.8206785137318255, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3919666', 'n_tokens_mistral': 577, 'n_tokens_neox': 555, 'n_words': 140}