<commit_before>/* NODE MODULES */
var net = require('net');
var eventEmitter = require('events').EventEmitter;
var tcpEventEmitter = require('../../utils/events/tcpEventEmitter');

/** LOCAL OBJECT 
 * @property {} - 
 */
var TOWER = {
    host: undefined,
    port: undefined,
    server: undefined,
    emitter: new eventEmitter()
};

/** MODULE INTERFACE
 *@method {function} - 
 */
module.exports = {
    listen: listen
};

/*----------------------------------------------------------------------------*/

/** 
 * @param
 * @returns
 */
function listen(port, onReady) {
    TOWER.server = net.createServer(function onNewAirport(socket) {
        var jsAirport = tcpEventEmitter.bind(socket);
        console.log('new airport connected');
    });

    TOWER.server.listen(port, function () {
        console.log('JSFly control tower listening on port '+port);
        onReady(TOWER.emitter);
        TOWER.emitter.emit('ready');
    });
}<commit_msg>Changed the port parameter for an options object parameter.<commit_after>/* NODE MODULES */
var net = require('net');
var eventEmitter = require('events').EventEmitter;
var tcpEventEmitter = require('../../utils/events/tcpEventEmitter');

/** LOCAL OBJECT 
 * @property {} - 
 */
var TOWER = {
    host: undefined,
    port: undefined,
    server: undefined,
    emitter: new eventEmitter()
};

/** MODULE INTERFACE
 *@method {function} - 
 */
module.exports = {
    listen: listen
};

/*----------------------------------------------------------------------------*/

/** Creates a TCP server to listen to other airport requests
 * @param {object} options - Options like the port to listen on
 * @param {function} onReady - A callback to be invoked when the server is ready
 * @returns
 */
function listen(options, onReady) {
    TOWER.server = net.createServer(function onNewAirport(socket) {
        var newAirport = tcpEventEmitter.bind(socket);
        controlTraffic(newAirport);
        console.log('new airport connected');
    });

    TOWER.server.listen(options.port, function () {
        console.log('JSFly control tower listening on port ' + options.port);
        onReady(TOWER.emitter);
        TOWER.emitter.emit('ready');
    });
}
{'fraction_non_alphanumeric': 0.20263516583371194, 'fraction_numerical': 0.0, 'mean_word_length': 2.45141065830721, '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': '3476475', 'n_tokens_mistral': 610, 'n_tokens_neox': 606, 'n_words': 157}