diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 565a67c42..ef9fc7473 100644 --- a/www/common/cryptpad-common.js +++ b/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(); diff --git a/www/common/outer/worker-channel.js b/www/common/outer/worker-channel.js index 42b91b802..545ce435b 100644 --- a/www/common/outer/worker-channel.js +++ b/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]; diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index 65feb67da..c786f7009 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -59,10 +59,11 @@ define([ logLevel: logLevel }); chainpad.onMessage(function(message, cb) { + // -1 ==> no timeout, we may receive the callback only when we reconnect sframeChan.query('Q_RT_MESSAGE', message, function (err) { if (!err) { evPatchSent.fire(); } cb(err); - }); + }, { timeout: -1 }); }); chainpad.onPatch(function () { onRemote({ realtime: chainpad });