lib/tcp.js
/*
 * sends a DONE signal to a remote beacon over a given connection
 * @param connection {Socket}: the socket connecting to the remote beacon
 * @return {Promise}
 */
sends a DONE signal to a remote beacon over a given connection
@param connection {Socket}: the socket connecting to the remote beacon
@return {Promise}
sends a DONE signal to a remote beacon over a given connection @param connection { Socket } : the socket connecting to the remote beacon @return { Promise }
function signalDoneOver(connection) {
    var hostId = connection.path + ":" + connection.port;
    return new Promise(function(resolve, reject) {
        connection.emit('SIGNAL:DONE', {});
        connection.on('DONE:ACK', function(data) {
            if(data.status) {
                resolve(true);
            }
            else {
                reject(new Error(hostId + " " + data.error));
            }
        });
    });
}
function signalDoneOver ( connection ) { var hostId = connection . path + ":" + connection . port ; return new Promise ( function ( resolve , reject ) { connection . emit ( 'SIGNAL:DONE' , { } ) ; connection . on ( 'DONE:ACK' , function ( data ) { if ( data . status ) { resolve ( true ) ; } else { reject ( new Error ( hostId + " " + data . error ) ) ; } } ) ; } ) ; }
sends a DONE signal to a remote beacon over a given connection
 @param connection {Socket}: the socket connecting to the remote beacon
 @return {Promise}
sends a DONE signal to a remote beacon over a given connection @param connection { Socket } : the socket connecting to the remote beacon @return { Promise }