Fix duplicate text bug on reconnect or ACK timeout

This commit is contained in:
yflory committed 2020-03-16 11:19:04 +01:00
1 parent a2b6501adb
commit 27c1291182
3 files changed
+11 -6

No files matched your search

+7 -4
View File
@@ -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];