From 0fe4e7ed41fbc4f541e09599a432583d9435f9de Mon Sep 17 00:00:00 2001 From: vdutta Date: Fri, 10 Dec 2021 12:46:59 +0530 Subject: [PATCH] Handle delay download processing time --- rpc_soap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpc_soap.c b/rpc_soap.c index 48251c3..fddcd23 100755 --- a/rpc_soap.c +++ b/rpc_soap.c @@ -32,6 +32,9 @@ #include "upload.h" #include "sched_inform.h" +#define PROCESSING_DELAY (1) // In download/upload the message enqueued before sending the response, which cause the download/upload + // to start just before the time. This delay is to compensate the time lapsed during the message enqueue and response + struct cwmp_namespaces ns; const struct rpc_cpe_method rpc_cpe_methods[] = { [RPC_CPE_GET_RPC_METHODS] = { "GetRPCMethods", cwmp_handle_rpc_cpe_get_rpc_methods, AMD_1 }, [RPC_CPE_SET_PARAMETER_VALUES] = { "SetParameterValues", cwmp_handle_rpc_cpe_set_parameter_values, AMD_1 }, @@ -2046,7 +2049,7 @@ int cwmp_handle_rpc_cpe_download(struct session *session, struct rpc *rpc) if (error == FAULT_CPE_NO_FAULT) { pthread_mutex_lock(&mutex_download); if (download_delay != 0) - scheduled_time = time(NULL) + download_delay; + scheduled_time = time(NULL) + download_delay + PROCESSING_DELAY; list_for_each (ilist, &(list_download)) { idownload = list_entry(ilist, struct download, list); @@ -2391,7 +2394,7 @@ int cwmp_handle_rpc_cpe_upload(struct session *session, struct rpc *rpc) if (error == FAULT_CPE_NO_FAULT) { pthread_mutex_lock(&mutex_upload); if (upload_delay != 0) - scheduled_time = time(NULL) + upload_delay; + scheduled_time = time(NULL) + upload_delay + PROCESSING_DELAY; list_for_each (ilist, &(list_upload)) { iupload = list_entry(ilist, struct upload, list);