Browse Source

Merge branch 'duplicateText2' into staging

master
yflory 9 months ago
parent
commit
c7688b7c8c
4 changed files with 17 additions and 8 deletions
  1. 3
      www/common/cryptpad-common.js
  2. 5
      www/common/outer/async-store.js
  3. 11
      www/common/outer/worker-channel.js
  4. 6
      www/common/sframe-chainpad-netflux-inner.js

3
www/common/cryptpad-common.js

@ -879,7 +879,8 @@ define([
postMessage("LEAVE_PAD", data, cb);
};
pad.sendPadMsg = function (data, cb) {
postMessage("SEND_PAD_MSG", data, cb);
// -1 ==> no timeout, we may receive the callback only when we reconnect
postMessage("SEND_PAD_MSG", data, cb, { timeout: -1 });
};
pad.onReadyEvent = Util.mkEvent();
pad.onMessageEvent = Util.mkEvent();

5
www/common/outer/async-store.js

@ -1596,7 +1596,10 @@ define([
onConnect: function (wc, sendMessage) {
channel.sendMessage = function (msg, cId, cb) {
// Send to server
sendMessage(msg, function () {
sendMessage(msg, function (err) {
if (err) {
return void cb({ error: err });
}
// Broadcast to other tabs
channel.pushHistory(CpNetflux.removeCp(msg), /^cp\|/.test(msg));
channel.bcast("PAD_MESSAGE", {

11
www/common/outer/worker-channel.js

@ -45,10 +45,13 @@ define([
var txid = mkTxid();
opts = opts || {};
var to = opts.timeout || 30000;
var timeout = setTimeout(function () {
delete queries[txid];
cb('TIMEOUT');
}, to);
var timeout;
if (to > 0) {
timeout = setTimeout(function () {
delete queries[txid];
cb('TIMEOUT');
}, to);
}
acks[txid] = function (err) {
clearTimeout(timeout);
delete acks[txid];

6
www/common/sframe-chainpad-netflux-inner.js

@ -61,10 +61,12 @@ define([
logLevel: logLevel
});
_chainpad.onMessage(function(message, cb) {
sframeChan.query('Q_RT_MESSAGE', message, function (err) {
// -1 ==> no timeout, we may receive the callback only when we reconnect
sframeChan.query('Q_RT_MESSAGE', message, function (_err, obj) {
var err = _err || (obj && obj.error);
if (!err) { evPatchSent.fire(); }
cb(err);
});
}, { timeout: -1 });
});
_chainpad.onPatch(function () {
onRemote({ realtime: chainpad });

Loading…
Cancel
Save