<commit_before>"use strict"

var net = require('net')
var cluster = require('cluster')
var log = require('debug')(require('./package.json').name + ' ' + process.pid)
var EventEmitter = require('events').EventEmitter
var which = require('which')

var path = require('path')

cluster.on('disconnect', function(worker) {
  log('disconnected worker %d.', worker.id)
})
.on('listening', function(worker) {
  log('worker listening %d.', worker.id)
})
.on('online', function(worker) {
  log('worker online %d.', worker.id)
})

module.exports = function(port, timeout, args) {
  // TODO: should probably make a 'class'
  // representing connection to worker
  var child = {
    connections: 0,
    status: new EventEmitter()
  }

  configureCluster(args, function() {
    var server = net.createServer(onConnection)
    server.listen(port, function() {
      log('listening on %d', server.address().port)
      if (process.send) process.send(server.address().port)
    })<commit_msg>Added a little debugging to make it easier to locate EADDRINUSE errors.<commit_after>"use strict"

var net = require('net')
var cluster = require('cluster')
var log = require('debug')(require('./package.json').name + ' ' + process.pid)
var EventEmitter = require('events').EventEmitter
var which = require('which')

var path = require('path')

cluster.on('disconnect', function(worker) {
  log('disconnected worker %d.', worker.id)
})
.on('listening', function(worker) {
  log('worker listening %d.', worker.id)
})
.on('online', function(worker) {
  log('worker online %d.', worker.id)
})

module.exports = function(port, timeout, args) {
  // TODO: should probably make a 'class'
  // representing connection to worker
  log('starting listener on port %d', port)
  var child = {
    connections: 0,
    status: new EventEmitter()
  }

  configureCluster(args, function() {
    var server = net.createServer(onConnection)
    server.listen(port, function() {
      log('listening on %d', server.address().port)
      if (process.send) process.send(server.address().port)
    })
{'fraction_non_alphanumeric': 0.16325536062378168, 'fraction_numerical': 0.0009746588693957114, 'mean_word_length': 4.360313315926893, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4060192', 'n_tokens_mistral': 616, 'n_tokens_neox': 615, 'n_words': 165}