From fb0834ffe14b44a88fa32a25b3366def4dc25a3e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 17 May 2020 15:28:00 +0200 Subject: [PATCH] added cookie caching and deletion --- devicehandlers/DeviceHandlerBase.cpp | 6 ++++-- devicehandlers/DeviceHandlerBase.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 84dd0811..b12d797a 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -23,8 +23,9 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, size_t cmdQueueSize) : SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE), wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS), - deviceCommunicationId(deviceCommunication), deviceThermalStatePoolId( - thermalStatePoolId),deviceThermalRequestPoolId(thermalRequestPoolId), + deviceCommunicationId(deviceCommunication), comCookie(comCookie), + deviceThermalStatePoolId(thermalStatePoolId), + deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this,setObjectId), modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance), hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr), @@ -44,6 +45,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, DeviceHandlerBase::~DeviceHandlerBase() { //communicationInterface->close(cookie); + delete comCookie; if (defaultFDIRUsed) { delete fdirInstance; } diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 379992b1..3d13f1e3 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -606,12 +606,12 @@ protected: /** * Communication object used for device communication */ - DeviceCommunicationIF *communicationInterface = nullptr; + DeviceCommunicationIF * communicationInterface = nullptr; /** * Cookie used for communication */ - CookieIF * comCookie = nullptr; + CookieIF * comCookie; struct DeviceCommandInfo { bool isExecuting; //!< Indicates if the command is already executing.