|
|
@ -520,37 +520,36 @@ const lokiFetch = async (url, options = {}, targetNode = null) => {
|
|
|
|
fetchOptions.body
|
|
|
|
fetchOptions.body
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (result === BAD_PATH) {
|
|
|
|
const getPathString = pathObjArr => {
|
|
|
|
const pathArr = [];
|
|
|
|
const pathArr = [];
|
|
|
|
path.forEach(node => {
|
|
|
|
pathObjArr.forEach(node => {
|
|
|
|
pathArr.push(`${node.ip}:${node.port}`);
|
|
|
|
pathArr.push(`${node.ip}:${node.port}`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return pathArr.join(', ');
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result === BAD_PATH) {
|
|
|
|
log.error(
|
|
|
|
log.error(
|
|
|
|
`[path] Error on the path: ${pathArr.join(', ')} to ${
|
|
|
|
`[path] Error on the path: ${getPathString(path)} to ${
|
|
|
|
targetNode.ip
|
|
|
|
targetNode.ip
|
|
|
|
}:${targetNode.port}`
|
|
|
|
}:${targetNode.port}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
lokiSnodeAPI.markPathAsBad(path);
|
|
|
|
lokiSnodeAPI.markPathAsBad(path);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (result) {
|
|
|
|
|
|
|
|
// not bad_path
|
|
|
|
// result maybe false
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
// will throw if there's a problem
|
|
|
|
// will throw if there's a problem
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await checkResponse(result, 'onion');
|
|
|
|
await checkResponse(result, 'onion');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// not truish and not bad_path
|
|
|
|
// false could mean, fail to parse results
|
|
|
|
// false could mean, fail to parse results
|
|
|
|
// or status code wasn't 200
|
|
|
|
// or status code wasn't 200
|
|
|
|
// or can't decrypt
|
|
|
|
// or can't decrypt
|
|
|
|
// it's not a bad_path, so we don't need to mark the path as bad
|
|
|
|
// it's not a bad_path, so we don't need to mark the path as bad
|
|
|
|
const pathArr = [];
|
|
|
|
|
|
|
|
path.forEach(node => {
|
|
|
|
|
|
|
|
pathArr.push(`${node.ip}:${node.port}`);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
log.error(
|
|
|
|
log.error(
|
|
|
|
`[path] sendOnionRequest gave false for path: ${pathArr.join(
|
|
|
|
`[path] sendOnionRequest gave false for path: ${getPathString(
|
|
|
|
', '
|
|
|
|
path
|
|
|
|
)} to ${targetNode.ip}:${targetNode.port}`
|
|
|
|
)} to ${targetNode.ip}:${targetNode.port}`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -583,13 +582,10 @@ const lokiFetch = async (url, options = {}, targetNode = null) => {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
// pass the false value up
|
|
|
|
// pass the false value up
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (result) {
|
|
|
|
|
|
|
|
|
|
|
|
// result maybe false
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
// will throw if there's a problem
|
|
|
|
// will throw if there's a problem
|
|
|
|
await checkResponse(result, 'proxy');
|
|
|
|
await checkResponse(result, 'proxy');
|
|
|
|
}
|
|
|
|
} // result is not truish and not explicitly false
|
|
|
|
|
|
|
|
|
|
|
|
// if not result, maybe we should throw??
|
|
|
|
// if not result, maybe we should throw??
|
|
|
|
// [] would make _retrieveNextMessages return undefined
|
|
|
|
// [] would make _retrieveNextMessages return undefined
|
|
|
|