New config option cwmp.downloadSuccessOnTimeout
Workaround for CPEs that neglect to send TransferComplete message after a successful download.
This commit is contained in:
1 parent
1d02893692
commit
088e25cbb0
1 file changed
+30
-2
+30
-2
@@ -458,7 +458,36 @@ export async function timeoutOperations(
|
||||
(e) => configContextCallback(sessionContext, e)
|
||||
) * 1000;
|
||||
|
||||
if (sessionContext.timestamp > operation.timestamp + DOWNLOAD_TIMEOUT) {
|
||||
if (sessionContext.timestamp < operation.timestamp + DOWNLOAD_TIMEOUT)
|
||||
continue;
|
||||
|
||||
logger.accessWarn({
|
||||
sessionContext: sessionContext,
|
||||
message: "Download operation timed out",
|
||||
commandKey: commandKey,
|
||||
});
|
||||
|
||||
const SUCCESS_ON_TIMEOUT = +localCache.getConfig(
|
||||
sessionContext.cacheSnapshot,
|
||||
"cwmp.downloadSuccessOnTimeout",
|
||||
{},
|
||||
sessionContext.timestamp,
|
||||
(e) => configContextCallback(sessionContext, e)
|
||||
);
|
||||
|
||||
if (SUCCESS_ON_TIMEOUT) {
|
||||
const r = {
|
||||
name: "TransferComplete" as const,
|
||||
commandKey: commandKey,
|
||||
startTime: 0,
|
||||
completeTime: 0,
|
||||
};
|
||||
|
||||
// Call transferComplete code and ignore the response
|
||||
await transferComplete(sessionContext, r);
|
||||
continue;
|
||||
}
|
||||
|
||||
delete sessionContext.operations[commandKey];
|
||||
if (!sessionContext.operationsTouched)
|
||||
sessionContext.operationsTouched = {};
|
||||
@@ -474,7 +503,6 @@ export async function timeoutOperations(
|
||||
|
||||
revertDownloadParameters(sessionContext, operation.args.instance);
|
||||
}
|
||||
}
|
||||
|
||||
return { faults, operations };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user