Skip to content

After the cosdo transfer is completed, the timer it created was not deleted. #173

@zllfdd

Description

@zllfdd

Describe the bug
When SDO is used frequently, the value of csdo->Tfer.Tmr keeps increasing and quickly exceeds the maximum number of timers, causing COTmrCreate() to return -1.

To Reproduce
Steps to reproduce the behavior:

  1. Repeated use of CSDO download or upload operations
  2. Looking at the value of csdo->Tfer.Tmr in the code below:
    csdo->Tfer.Tmr = COTmrCreate(&(csdo->Node->Tmr), ticks, 0, &COCSdoTimeout, csdo);

Expected behavior
The value of csdo->Tfer.Tmr keeps increasing and will exceed the maximum number of timers.

CANopen Stack (please complete the following information):

  • Version V4.4.0

Additional context
In the function static void COCSdoTransferFinalize(CO_CSDO *csdo), the timer was not deleted; csdo->Tfer.Tmr was simply assigned the value -1:
csdo->Tfer.Tmr = -1;

After making the following modifications, this issue no longer occurs:

@@ -160,7 +160,8 @@ static void COCSdoTransferFinalize(CO_CSDO *csdo)
         if (call != NULL) {
             call(csdo, idx, sub, code);
         }


+        (void)COTmrDelete(&(csdo->Node->Tmr), csdo->Tfer.Tmr);
         /* Reset finished transfer information */
         csdo->Tfer.Type  = CO_CSDO_TRANSFER_NONE;
         csdo->Tfer.Abort = 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions