*remove error

This commit is contained in:
Derrick Hammer 2022-08-06 01:13:15 -04:00
parent 909e8be59e
commit 3ca8fd9711
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 4 deletions

View File

@ -28,7 +28,7 @@ let dht: DHT;
addHandler("presentSeed", handlePresentSeed); addHandler("presentSeed", handlePresentSeed);
addHandler("refreshGatewayList", handleRefreshGatewayList); addHandler("refreshGatewayList", handleRefreshGatewayList);
addHandler("statIpfs", handleStatIpfs); addHandler("statIpfs", handleStatIpfs);
addHandler("fetchIpfs", handleFetchIpfs, { se }); addHandler("fetchIpfs", handleFetchIpfs);
addHandler("statIpns", handleStatIpns); addHandler("statIpns", handleStatIpns);
addHandler("fetchIpns", handleFetchIpns); addHandler("fetchIpns", handleFetchIpns);
@ -64,7 +64,7 @@ async function handleFetchIpfs(aq: ActiveQuery) {
} }
async function handleStatIpns(aq: ActiveQuery) { async function handleStatIpns(aq: ActiveQuery) {
return handleStat(aq, "stat_ipns", "ipfs"); return handleStat(aq, "stat_ipns", "ipns");
} }
async function handleFetchIpns(aq: ActiveQuery) { async function handleFetchIpns(aq: ActiveQuery) {
@ -196,7 +196,9 @@ async function rpcCall(
let timer: NodeJS.Timeout; let timer: NodeJS.Timeout;
let dataCount = 0; let dataCount = 0;
socket.on("data", (res) => { socket.on("data", (res) => {
if (timer && timer.close) {
clearTimeout(timer as number); clearTimeout(timer as number);
}
dataCount++; dataCount++;
const response = unpack(res); const response = unpack(res);
if (!response || response.error || (response && response?.data?.error)) { if (!response || response.error || (response && response?.data?.error)) {
@ -229,7 +231,7 @@ async function rpcCall(
timer = setTimeout(() => { timer = setTimeout(() => {
socket.end(); socket.end();
reject("timeout"); reject("timeout");
}, 5 * 1000) as NodeJS.Timeout; }, 10 * 1000) as NodeJS.Timeout;
}); });
} }