From 5ba4dce248be6721b6aa2e5e927f0d3f6490181c Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 7 Feb 2013 16:01:08 +0300 Subject: [PATCH] Ignore GetParameterValues errors during initialization step --- acs.coffee | 2 +- tasks.coffee | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/acs.coffee b/acs.coffee index 66da7e5..8658840 100644 --- a/acs.coffee +++ b/acs.coffee @@ -106,6 +106,7 @@ runTask = (currentRequest, task, methodResponse) -> nextTask(currentRequest) ) when tasks.STATUS_FAULT + util.log("#{currentRequest.deviceId}: Fault response for task #{taskId}") db.saveTask(task, (err) -> # Faulty task. No more work to do until task is deleted. res = tr069.response(null, cwmpResponse) @@ -261,7 +262,6 @@ else ) else if cwmpRequest.fault? taskId = cwmpRequest.id - util.log("#{currentRequest.deviceId}: Fault response for task #{taskId}") db.getTask(taskId, (task) -> if not task diff --git a/tasks.coffee b/tasks.coffee index 425681d..e362539 100644 --- a/tasks.coffee +++ b/tasks.coffee @@ -9,14 +9,14 @@ exports.STATUS_FINISHED = STATUS_FINISHED = 4 this.init = (task, methodResponse, cwmpResponse, deviceUpdates) -> - if methodResponse.faultcode? - task.fault = methodResponse - return STATUS_FAULT - if not task.subtask? task.subtask = {'name' : 'getParameterNames', 'parameterPath' : '', 'nextLevel' : false} if task.subtask.name == 'getParameterNames' + if methodResponse.faultcode? + task.fault = methodResponse + return STATUS_FAULT + status = this.getParameterNames(task.subtask, methodResponse, cwmpResponse, deviceUpdates) if status is STATUS_FINISHED parameterNames = [] @@ -28,10 +28,14 @@ this.init = (task, methodResponse, cwmpResponse, deviceUpdates) -> throw Error('Unexpected subtask status') if task.subtask.name == 'getParameterValues' - status = this.getParameterValues(task.subtask, methodResponse, cwmpResponse, deviceUpdates) + if methodResponse.faultcode? + # Ignore GetParameterValues errors. A workaround for the crappy Seewon devices. + status = this.getParameterValues(task.subtask, {parameterList : {}}, cwmpResponse, deviceUpdates) + else + status = this.getParameterValues(task.subtask, methodResponse, cwmpResponse, deviceUpdates) if status is STATUS_FINISHED return STATUS_FINISHED - else if status is not STATUS_STARTED + else if status isnt STATUS_STARTED throw Error('Unexpected subtask status') return STATUS_STARTED