|
|
@ -578,6 +578,12 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
console.error("CHANNEL_ERROR", info);
|
|
|
|
console.error("CHANNEL_ERROR", info);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onConnectionChange = function (info) {
|
|
|
|
|
|
|
|
if (info.state) { return; }
|
|
|
|
|
|
|
|
// Disconnect: don't send event anymore until ready
|
|
|
|
|
|
|
|
ready = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onConnect = function (/* wc, sendMessage */) {
|
|
|
|
var onConnect = function (/* wc, sendMessage */) {
|
|
|
|
console.log("ROSTER CONNECTED");
|
|
|
|
console.log("ROSTER CONNECTED");
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -621,12 +627,12 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
|
|
|
|
|
|
|
|
// if a checkpoint was successfully applied, emit an event
|
|
|
|
// if a checkpoint was successfully applied, emit an event
|
|
|
|
if (parsed[0] === 'CHECKPOINT' && changed) {
|
|
|
|
if (parsed[0] === 'CHECKPOINT' && changed) {
|
|
|
|
events.checkpoint.fire(hash);
|
|
|
|
if (isReady()) { events.checkpoint.fire(hash); }
|
|
|
|
// reset the counter for messages since the last checkpoint
|
|
|
|
// reset the counter for messages since the last checkpoint
|
|
|
|
ref.internal.sinceLastCheckpoint = 0;
|
|
|
|
ref.internal.sinceLastCheckpoint = 0;
|
|
|
|
ref.internal.lastCheckpointHash = hash;
|
|
|
|
ref.internal.lastCheckpointHash = hash;
|
|
|
|
} else if (changed) {
|
|
|
|
} else if (changed) {
|
|
|
|
events.change.fire();
|
|
|
|
if (isReady()) { events.change.fire(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CHECKPOINT logic...
|
|
|
|
// CHECKPOINT logic...
|
|
|
@ -833,7 +839,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
onChannelError: onChannelError,
|
|
|
|
onChannelError: onChannelError,
|
|
|
|
onReady: onReady,
|
|
|
|
onReady: onReady,
|
|
|
|
onConnect: onConnect,
|
|
|
|
onConnect: onConnect,
|
|
|
|
onConnectionChange: function () {},
|
|
|
|
onConnectionChange: onConnectionChange,
|
|
|
|
onMessage: onMessage,
|
|
|
|
onMessage: onMessage,
|
|
|
|
|
|
|
|
|
|
|
|
noChainPad: true,
|
|
|
|
noChainPad: true,
|
|
|
|