<commit_before>chrome.app.runtime.onLaunched.addListener(function (launchData) {
    chrome.app.window.create('index.html', {'bounds': {
        'width': 800,
        'height': 600
    }, 'maxWidth': 800,
        'maxHeight': 600}, function (win) {
        win.contentWindow.launchData = launchData;
        win.onClosed.addListener(function () {
            var appController = ApplicationController.getInstance();
            appController.appClosed();
        });
    });
});

var comm = Communication.getInstance();

var serverRepProtocol = new ServerReplicationProtocol();
comm.setServerReplicationProtocol(serverRepProtocol);

var serverRecoveryProtocol = new ServerRecoveryProtocol();
comm.setServerRecoveryProtocol(serverRecoveryProtocol);

var n = Network.getInstance();

var promise = new Promise(function (resolve, reject) {
    n.loadNetworkInterfaces(resolve);
});

promise.then(function () {


    /**
     * Causal Broadcast Protocol
     */
    var cbProtocol = new CausalBroadcastProtocol(5677);
    comm.setPeerReplicationProtocol(cbProtocol);

    var replicationDataReceived_DxmWj16N13ZH = (function (data) {
        cbProtocol.handleMessage(data);
    });

    debug("Starting the multicast socket creation part on port ["+cbProtocol.port+"]....");
    n.createMulticastSocket(cbProtocol.ip, cbProtocol.port, replicationDataReceived_DxmWj16N13ZH);

    /**
     * Peer Discovery Protocol
     */
    var pdProtocol = new PeerDiscoveryProtocol(5678);
    comm.setPeerDiscoveryProtocol(pdProtocol);

    var replicationDataReceived_SxqdH6LZHLEb = (function (data) {
        pdProtocol.handleMessage(data);
    });

    debug("Starting the multicast socket creation part on port ["+pdProtocol.port+"]....");
    n.createMulticastSocket(pdProtocol.ip, pdProtocol.port, replicationDataReceived_SxqdH6LZHLEb);

}).then(function () {
            /**
             * Direct Replication Protocol
             */
            var drProtocol = new PeerRecoveryProtocol(5679);
            comm.setPeerRecoveryProtocol(drProtocol);

            var replicationDirectRequest_EzgZfgrrft44 = (function (data, socket) {
                drProtocol.handleMessage(data, socket);
            })

            debug("Starting the TCP socket creation part");
            n.createTCPServerSockets(replicationDirectRequest_EzgZfgrrft44);

        });

// Add a listener to the internal message passing mechanism of the app
function callback_oAk9bgKDjyjd(message, sender, sendResponse) {
    BackEndMessaging.handleMessage(message, sender, sendResponse);
}
chrome.runtime.onMessage.addListener(callback_oAk9bgKDjyjd);

<commit_msg>Exchanged the CausalBroadcast protocol for the NewsCast protocol. Easy exchangeable from now on :)<commit_after>chrome.app.runtime.onLaunched.addListener(function (launchData) {
    chrome.app.window.create('index.html', {'bounds': {
        'width': 800,
        'height': 600
    }, 'maxWidth': 800,
        'maxHeight': 600}, function (win) {
        win.contentWindow.launchData = launchData;
        win.onClosed.addListener(function () {
            var appController = ApplicationController.getInstance();
            appController.appClosed();
        });
    });
});

var comm = Communication.getInstance();

var serverRepProtocol = new ServerReplicationProtocol();
comm.setServerReplicationProtocol(serverRepProtocol);

var serverRecoveryProtocol = new ServerRecoveryProtocol();
comm.setServerRecoveryProtocol(serverRecoveryProtocol);

var n = Network.getInstance();

var promise = new Promise(function (resolve, reject) {
    n.loadNetworkInterfaces(resolve);
});

promise.then(function () {


//    /**
//     * Causal Broadcast Protocol
//     */
//    var cbProtocol = new CausalBroadcastProtocol(5677);
//    comm.setPeerReplicationProtocol(cbProtocol);
//
//    var replicationDataReceived_DxmWj16N13ZH = (function (data) {
//        cbProtocol.handleMessage(data);
//    });
//
//    debug("Starting the multicast socket creation part on port ["+cbProtocol.port+"]....");
//    n.createMulticastSocket(cbProtocol.ip, cbProtocol.port, replicationDataReceived_DxmWj16N13ZH);


    /**
     * Causal Broadcast Protocol
     */
    var cbProtocol = new NewsCastPeerReplicationProtocol(5677);
    comm.setPeerReplicationProtocol(cbProtocol);

    var replicationDataReceived_DxmWj16N13ZH = (function (data, socketId) {
        cbProtocol.handleMessage(data, socketId);
    });

    var socketCreated_Y2ZQPh5hE8Et = function (socketId){
        cbProtocol.setSocketId(socketId);
    };

    debug("Starting the multicast socket creation part on port [" + cbProtocol.port + "]....");
    n.createUDPSocket(cbProtocol.socketIp, cbProtocol.port, replicationDataReceived_DxmWj16N13ZH, socketCreated_Y2ZQPh5hE8Et);


    /**
     * Peer Discovery Protocol
     */
    var pdProtocol = new PeerDiscoveryProtocol(5678);
    comm.setPeerDiscoveryProtocol(pdProtocol);

    var replicationDataReceived_SxqdH6LZHLEb = (function (data) {
        pdProtocol.handleMessage(data);
    });

    debug("Starting the multicast socket creation part on port [" + pdProtocol.port + "]....");
    n.createMulticastSocket(pdProtocol.ip, pdProtocol.port, replicationDataReceived_SxqdH6LZHLEb);

}).then(function () {
            /**
             * Direct Replication Protocol
             */
            var drProtocol = new PeerRecoveryProtocol(5679);
            comm.setPeerRecoveryProtocol(drProtocol);

            var replicationDirectRequest_EzgZfgrrft44 = (function (data, socket) {
                drProtocol.handleMessage(data, socket);
            })

            debug("Starting the TCP socket creation part");
            n.createTCPServerSockets(replicationDirectRequest_EzgZfgrrft44);

        });

// Add a listener to the internal message passing mechanism of the app
function callback_oAk9bgKDjyjd(message, sender, sendResponse) {
    BackEndMessaging.handleMessage(message, sender, sendResponse);
}
chrome.runtime.onMessage.addListener(callback_oAk9bgKDjyjd);


{'fraction_non_alphanumeric': 0.10949757970288766, 'fraction_numerical': 0.016357870138541144, 'mean_word_length': 3.5188536953242835, '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': '1246416', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1670, 'n_words': 322}